1 ########################################################################
3 # This software is part of the ast package #
4 # Copyright (c) 1994-2016 AT&T Intellectual Property #
5 # and is licensed under the #
6 # Eclipse Public License, Version 1.0 #
7 # by AT&T Intellectual Property #
9 # A copy of the License is available at #
10 # http://www.eclipse.org/org/documents/epl-v10.html #
11 # (with md5 checksum b35adb5213ca9657e911e9befb180842) #
13 # Information and Software Systems Research #
17 # Glenn Fowler <glenn.s.fowler@gmail.com> #
19 ########################################################################
20 ########################################################################
22 # This software is part of the ast package #
23 # Copyright (c) 1994-2013 AT&T Intellectual Property #
24 # and is licensed under the #
25 # Eclipse Public License, Version 1.0 #
26 # by AT&T Intellectual Property #
28 # A copy of the License is available at #
29 # http://www.eclipse.org/org/documents/epl-v10.html #
30 # (with md5 checksum b35adb5213ca9657e911e9befb180842) #
32 # Information and Software Systems Research #
36 # Glenn Fowler <glenn.s.fowler@gmail.com> #
38 ########################################################################
39 # Glenn Fowler & Phong Vo
42 # test if feature exists
43 # this script is written to make it through all sh variants
45 # NOTE: .exe a.out suffix and [\\/] in path patterns for dos/nt
47 case $
-:$BASH_VERSION in
48 *x
*:[0123456789]*) : bash
set -x is broken
:; set +ex
;;
52 version
=2013-11-14 # update in USAGE too #
60 case $_compile_status in
61 [1-9]|
[1-9][0-9]|
1[01][0-9]|
12[0-7])
62 if egrep -i -c 'terminated with signal|core dump|segmentation fault' $tmp.err
>&$nullout
63 then _compile_status
=139
68 case $_compile_status in
69 ?|??|
1[01]?|
12[0-8]|
25?
)
71 *) echo "$command: $@" >&$stderr
72 cat $tmp.err
>&$stderr
73 echo "$command: $1: core dump or fatal interruption -- results inconclusive" >&$stderr
77 return $_compile_status
80 is_hdr
() # [ - ] [ file.c ] hdr
83 -) _is_hdr_flag
=-; shift ;;
87 *.c
) _is_hdr_file
=$1; shift ;;
88 *) _is_hdr_file
=$tmp.c
;;
91 compile
$cc -c $_is_hdr_file <&$nullin >&$nullout 2>$tmp.e
93 case $_is_hdr_status in
95 then case `grep '#.*error' $tmp.e` in
96 ?
*) _is_hdr_status
=1 ;;
101 case $_is_hdr_status in
102 0) success
$_is_hdr_flag
105 3) cat $tmp.e
>&$stderr ;;
107 failure
$_is_hdr_flag
110 return $_is_hdr_status
116 '') pth
=`getconf PATH 2>/dev/null`
118 '') pth
="/bin /usr/bin" ;;
119 *:*) pth
=`echo "$pth" | sed 's/:/ /g'` ;;
143 pth
="{ usr . - . contrib local $i - . share - . lib - $1"
153 pth
="$pth ${i}R$1 ${i}.$1"
171 cmd
) mm
="a command" ;;
172 dat
) mm
="a library data symbol" ;;
173 dfn
) mm
="a macro with extractable value" ;;
175 hdr
) mm
="a header" ;;
176 id
) mm
="an identifier" ;;
177 lcl
) mm
="a native header" ;;
178 key
) mm
="a reserved keyword" ;;
179 lib
) mm
="a library function" ;;
181 "") mm
="a library" ;;
182 *) ii
=$
*; mm
="a library group" ;;
186 mem
) mm
="a member of $2" ;;
187 mth
) mm
="a math library symbol" ;;
188 nos
) mm
="a non-opaque struct" ;;
189 npt
) mm
="a symbol that needs a prototype" ;;
190 num
) mm
="a numeric constant or enum" ;;
191 nxt
) mm
="an include path for the native header" ;;
192 opt
) mm
="set in \$PACKAGE_OPTIONS" ;;
194 run
) yy
="capture output of" mm
= ;;
195 siz
) mm
="a type with known size" ;;
196 sym
) mm
="a typed variable" ;;
197 sys
) mm
="a system header" ;;
198 typ
) mm
="a type or typedef" ;;
199 val
) yy
="determine" mm
="value" ;;
203 [abcdefghijklmnopqrstuvwxyz
]*[abcdefghijklmnopqrstuvwxyz
]'{') ii
="$ii ... }end" ;;
205 $show "$command: test:" $yy $ii $mm "...$SHOW" >&$stderr
219 UNKNOWN
) result
=SUCCESS
;;
226 case $complete:$verbose in
227 1:1) case $suspended in
229 $show "$command: test:" $yy $ii $mm "...$SHOW" >&$stderr
238 0) echo " $mm" >&$stderr ;;
239 *) echo "$command: ... $mm" >&$stderr ;;
255 case $complete:$verbose in
256 1:1) case $suspended in
258 $show "$command: test:" $yy $ii $mm "...$SHOW" >&$stderr
272 0) echo " $mm" >&$stderr ;;
273 *) echo "$command: ... $mm" >&$stderr ;;
281 # - ignore global status
283 # -1 inverted sense if ! def
284 # status test status 0:success *:failure
285 # success success comment
286 # failure failure comment
287 # default default setting comment
291 # $not invert test sense
296 report
() # [-] [-0] [-1] status value success failure default
311 ''|
-) case $_report_not in
320 case $_report_ignore:$_report_status in
322 *:0) success
$_report_ignore
324 *) failure
$_report_ignore
332 1) case $_report_status in
333 0) _report_status
=1 ;;
334 *) _report_status
=0 ;;
339 *) _report_success
=$3
344 case $_report_status in
347 *) usr
="$usr$nl#define $m $_report_value"
348 case $_report_success in
351 1) echo "#define $m $_report_value /* $_report_success */" ;;
352 n
) echo "$m=$_report_value"
356 eval $m=\'$_report_value\'
362 *) case $_report_failure in
364 *) case $define$all$config$undef in
365 1?
1?|
1??
1)echo "#undef $m /* $_report_failure */" ;;
366 11??
) echo "#define $m 0 /* $_report_failure */" ;;
372 case $_report_default in
374 *) case $define$set in
375 1?
*) echo "#define $v $set /* $_report_default */" ;;
376 n?
*) echo "$v=$set" ;;
389 case $complete:$verbose in
398 literal
() # line that echo might process
403 then : old here doc botch not present
404 else case $here_broken in
406 echo "$command: your shell botches here documents; this was fixed back in the 80's" >&$stderr
416 copy
() # "output-file" "data-that-must-not-be-processed-by-echo"
425 then : ancient here doc botch not present
426 else case $here_broken in
428 echo "$command: your shell botches here documents; this was fixed back in the 80's" >&$stderr
440 ksh
) print
-r - "$2" > "$1"
445 then : ancient here doc botch not present
446 else case $here_broken in
448 echo "$command: your shell botches here documents; this was fixed back in the 80's" >&$stderr
451 sh
-c "cat > \"$1\" <<!
462 # verify that cc is a C compiler
466 # check for local package root directories
468 case $PACKAGE_PATH in
469 ?
*) for i
in `echo $PACKAGE_PATH | sed 's,:, ,g'`
470 do if test -d $i/include
471 then cc
="$cc -I$i/include"
472 occ
="$occ -I$i/include"
475 then cc
="$cc -L$i/lib"
478 do eval $y=\"\$
$y:\
$i/lib\$
${y}_default
\"
485 echo "int i = 1;" > $tmp.c
486 if compile
$cc -c $tmp.c
<&$nullin >&$nullout
487 then echo "(;" > $tmp.c
488 if compile
$cc -c $tmp.c
<&$nullin >&$nullout
489 then cctest
="should not compile '(;'"
491 else cctest
="should compile 'int i = 1;'"
496 *) echo "$command: $cc: not a C compiler: $cctest" >&$stderr
509 *) posix_read
=`(read -r _checkread_line; echo $_checkread_line) 2>/dev/null <<!
528 while (read(0, &c, 1) == 1)
532 if (c == ' ' || c == '\\t')
538 if (k > 1 && c != '#' && c != '\\n' && c != '\\r')
539 write(1, s + 1, k - 1);
545 if (read(0, &c, 1) == 1 && c != '\\n')
554 if compile
$cc -o ${tmp}r.exe
${tmp}r.c
>&$nullout
555 then posix_read
=${tmp}r.exe
556 else echo "$command: cannot compile read -r workaround" >&$stderr
566 0) noteout
=$nullout ;;
567 *) noteout
=$stderr ;;
569 if test "" != "$cross"
570 then crossexec
$cross "$@" $tmp.u
9>&$noteout
572 elif test -d /NextDeveloper
573 then "$@" $tmp.u
<&$nullin >&$nullout 9>&$noteout
575 "$@" $tmp.u
<&$nullin |
cat
576 else "$@" $tmp.u
9>&$noteout
579 rm -rf $tmp.u
* > /dev
/null
2>&1
589 do eval _exclude_old
=\$
$_exclude_var
590 case $_exclude_old in
596 for _exclude_arg
in $_exclude_old
598 for _exclude_dir
in $excludes
599 do case $_exclude_arg in
600 -I$_exclude_dir|
-I*/$_exclude_dir)
606 case $_exclude_skip in
607 '') _exclude_new
="$_exclude_new$_exclude_sep$_exclude_arg"
612 eval $_exclude_var=\
$_exclude_new
615 *) echo $command: exclude
$_exclude_var: "$_exclude_old => $_exclude_new" >&$stderr
624 binding
="-dy -dn -Bdynamic -Bstatic -Wl,-ashared -Wl,-aarchive -call_shared -non_shared '' -static"
648 libpaths
="LD_LIBRARY_PATH LD_LIBRARYN32_PATH LD_LIBRARY64_PATH LIBPATH SHLIB_PATH"
649 LD_LIBRARY_PATH_default
=:/lib
:/usr
/lib
650 LD_LIBRARYN32_PATH_default
=:/lib32
:/usr
/lib32
651 LD_LIBRARY64_PATH_default
=:/lib64
:/usr
/lib64
652 LIBPATH_default
=:/lib
:/usr
/lib
653 SHLIB_PATH_default
=:/shlib
:/usr
/shlib
:/lib
:/usr
/lib
661 case `(set -f && set x * && echo $# && set +f) 2>/dev/null` in
662 2) posix_noglob
="set -f" posix_glob
="set +f" ;;
663 *) case `(set -F && set x * && echo $# && set +F) 2>/dev/null` in
664 2) posix_noglob
="set -F" posix_glob
="set +F" ;;
665 *) posix_noglob
=":" posix_glob
=":" ;;
675 ($executable .
) 2>/dev
/null || executable
='test -r'
676 ($exists .
) 2>/dev
/null || exists
='test -r'
678 *) case $BASH_VERSION in
690 "") case $HOSTNAME in
691 ""|?|??|???|????|????
)
695 bsh
) eval `echo $HOSTNAME | sed 's/\\(....\\).*/tmp=\\1/'` ;;
696 *) eval 'tmp=${HOSTNAME%${HOSTNAME#????}}' ;;
711 bsh
) eval `echo $tmp | sed 's/\\(.........\\).*/tmp=\\1/'` ;;
712 *) eval 'tmp=${tmp%${tmp#?????????}}' ;;
729 # options -- `-' for output to stdout otherwise usage
736 case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in
739 @(#)$Id: iffe (AT&T Research) 2013-11-14 $
742 [+NAME?iffe - C compilation environment feature probe]
743 [+DESCRIPTION?\biffe\b is a command interpreter that probes the C
744 compilation environment for features. A feature is any file, option
745 or symbol that controls or is controlled by the C compiler. \biffe\b
746 tests features by generating and compiling C programs and observing
747 the behavior of the C compiler and generated programs.]
748 [+?\biffe\b statements are line oriented. Statements may appear in the
749 operand list with the \b:\b operand or \bnewline\b as the line
750 delimiter. The standard input is read if there are no command
751 line statements or if \afile\a\b.iffe\b is omitted.]
752 [+?Though similar in concept to \bautoconf\b(1) and \bconfig\b(1), there
753 are fundamental differences. The latter tend to generate global
754 headers accessed by all components in a package, whereas \biffe\b is
755 aimed at localized, self contained feature testing.]
756 [+?Output is generated in \bFEATURE/\b\atest\a by default, where \atest\a is
757 the base name of \afile\a\b.iffe\b or the \biffe\b \brun\b
758 file operand. Output is first generated in a temporary file; the
759 output file is updated if it does not exist or if the temporary file
760 is different. If the first operand is \b-\b then the output is written
761 to the standard output and no update checks are done.]
762 [+?Files with suffixes \b.iffe\b and \b.iff\b are assumed to contain
763 \biffe\b statements.]
764 [a:all?Define failed test macros \b0\b. By default only successful test macros
766 [c:cc?Sets the C compiler name and flags to be used in the feature
767 tests.]:[C-compiler-name [C-compiler-flags ...]]]
768 [C:config?Generate \bconfig\b(1) style \aHAVE_\a* macro names. This implies
769 \b--undef\b. Since \bconfig\b(1) has inconsistent naming conventions,
770 the \bexp\b op may be needed to translate from the (consistent)
771 \biffe\b names. Unless otherwise noted a \bconfig\b macro name
772 is the \biffe\b macro name prefixed with \bHAVE\b and converted to
773 upper case. \b--config\b is set by default if the command arguments
774 contain a \brun\b op on an input file with the base name \bconfig\b.]
775 [d:debug?Sets the debug level. Level 0 inhibits most
776 error messages, level 1 shows compiler messages, and
777 level 2 traces internal \biffe\b \bsh\b(1) actions and does
778 not remove core dumps on exit.]#[level]
779 [D:define?Successful test macro definitions are emitted. This is the default.]
780 [E:explicit?Disable implicit test output.]
781 [F:features?Sets the feature test header to \ahdr\a. This header typically
782 defines *_SOURCE feature test macros.]:[hdr:=NONE]
783 [i:input?Sets the input file name to \afile\a, which
784 must contain \biffe\b statements.]:[file]
785 [I:include?Adds \b-I\b\adir\a to the C compiler flags.]:[dir]
786 [L:library?Adds \b-L\b\adir\a to the C compiler flags.]:[dir]
787 [n:name-value?Output \aname\a=\avalue\a assignments only.]
788 [N!:optimize?\b--nooptimize\b disables compiler optimization options.]
789 [o:output?Sets the output file name to \afile\a.]:[file]
790 [O:stdio?Sets the standard io header to \ahdr\a.]:[hdr:=stdio.h]
791 [e:package?Sets the \bproto\b(1) package name to \aname\a.]:[name]
792 [p:prototyped?Emits \b#pragma prototyped\b at the top of the
793 output file. See \bproto\b(1).]
794 [P:pragma?Emits \b#pragma\b \atext\a at the top of the output file.]:[text]
795 [r:regress?Massage output for regression testing.]
796 [s:shell?Sets the internal shell name to \aname\a. Used for debugging
797 Bourne shell compatibility (otherwise \biffe\b uses \aksh\a constructs
798 if available). The supported names are \bksh\b, \bbsh\b, \bbash\b, and
799 \bosh\b. \bosh\b forces the \bread -r\b compatibility read command to
800 be compiled and used instead of \bread -r\b. The default is determined
801 by probing the shell at startup.]:[name]
802 [S:static?Sets the C compiler flags that force static linking. If not set
803 then \biffe\b probes the compiler to determine the flags. \biffe\b
804 must use static linking (no dlls) because on some systems missing
805 library symbols are only detected when referenced at runtime from
806 dynamically linked executables.]:[flags]
807 [u:undef?\b#undef\b failed test macros. By default only successful test macros
809 [v:verbose?Produce a message line on the standard error for each test as
811 [x:cross?Some tests compile an executable (\ba.out\b) and then run it.
812 If the C compiler is a cross compiler and the executable format is
813 incompatible with the execution environment then the generated
814 executables must be run in a different environment, possibly on
815 another host. \acrosstype\a is the HOSTTYPE for generated executables
816 (the \bpackage\b(1) command generates a consistent HOSTTYPE namespace).
817 Generated executables are run via \bcrossexec\b(1) with \acrosstype\a
818 as the first argument. \bcrossexec\b supports remote execution for
819 cross-compiled executables. See \bcrossexec\b(1) for
820 details.]:[crosstype]
821 [X:exclude?Removes \b-I\b\adir\a and \b-I\b*/\adir\a C compiler flags.]:[dir]
823 [ - ] [ file.iffe | statement [ : statement ... ] ]
825 [+SYNTAX?\biffe\b input consists of a sequence of statement lines. Statements
826 that span more than one line contain \abegin\a\b{\b as the last
827 operand (where \abegin\a is command specific) and zero
828 or more data lines terminated by a line containing
829 \b}end\b as the first operand. The statement syntax is:
830 [\aname\a \b=\b]] [\b!\b]] \atest\a[,\atest\a...]] [\b-\b]]
831 [\aarg\a[,\aarg\a...]]]] [\aprereq\a ...]]
832 [\abegin\a{ ... |\bend\b ...]] [= [\adefault\a]]]].
833 \atest\as and \aarg\as may be combined, separated by commas, to perform
834 a set of tests on a set of arguments. \aname\a \b=\b before \atest\a
835 overrides the default test variable and macro name, and \b-\b after
836 \atest\a performs the test but does not define the test variable and
837 macro values. \b!\b before \atest\a inverts the test sense for \bif\b,
838 \belif\b, and \byes{\b and \bno{\b blocks.]
839 [+?\aprereq\as are used when applying the features tests and may be
841 [+compiler options?\b-D\b*, \b-L\b*, etc.]
842 [+library references?\b-l\b*, *\b.a\b, etc. \b_LIB_\b\aname\a
843 is defined to be 1 if \b-l\b\aname\a is a library.]
844 [+header references?*\b.h\b. \a_dir_name\a is defined to be 1
845 if \adir/name\a\b.h\b is a header, or if \adir\a is
846 omitted, \b_hdr_\b\aname\a is defined to be 1 if
847 \aname\a\b.h\b is a header.]
848 [+-?Prereq grouping mark; prereqs before the first \b-\b are
849 passed to all feature tests. Subsequent groups
850 are attempted in left-to-right order until the first
851 successful group is found.]
853 [+?\abegin\a\b{\b ... \b}end\b delimit multiline code blocks that override
854 or augment the default code provided by \biffe\b. User supplied code
855 blocks should be compatible with the K&R, ANSI, and C++ C language
856 dialects for maximal portability. Test code may call the function
857 \bNOTE("...")\b to emit short text in \b--verbose\b output; only one
858 \bNOTE()\b should be called per test for readability. In addition to
859 all macro definitions generated by previous tests, all generated
860 code contains the following at the top to hide dialect differences:]{
861 [+ ?#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)]
863 [+ ?#define _ARG_(x) x]
864 [+ ?#define _VOID_ void]
867 [+ ?#define _ARG_(x) ()]
868 [+ ?#define _VOID_ char]
870 [+ ?#if defined(__cplusplus)]
871 [+ ?#define _BEGIN_EXTERNS_ extern "C" {]
872 [+ ?#define _END_EXTERNS_ }]
874 [+ ?#define _BEGIN_EXTERNS_]
875 [+ ?#define _END_EXTERNS_]
877 [+ ?#define _NIL_(x) ((x)0)]
878 [+ ?#include <stdio.h>]
880 [+?= \adefault\a may be specified for the \bkey\b, \blib\b, \bmac\b, \bmth\b
881 and \btyp\b tests. If the test fails for \aarg\a then
882 \b#define\b \aarg\a \adefault\a is emitted. \bkey\b accepts multiple
883 \b= \b\adefault\a values; the first valid one is used.]
884 [+?Each test statement generates a portion of a C language header that contains
885 macro defintions, comments, and other text corresponding to the feature
886 tests. \b#ifndef _def_\b\aname\a\b_\b\adirectory\a ...
887 \b#endif\b guards the generated header from multiple \b#include\bs,
888 where \aname\a is determined by either the \brun\b statement input file
889 name if any, or the first \atest\a in the first statement, and \adirectory\a
890 is the basename component of either the \brun\b statement file, if any,
891 or the current working directory. The output file name is determined
893 [+-?If the first command line operand is \b-\b then the output
894 is written to the standard output.]
895 [+--output=\afile\a?Output is \afile\a.]
896 [+set out \afile\a?Output is \afile\a.]
897 [+[run]] [\adirectory\a/]]\abase\a[\a.suffix\a]]?Output is
898 \bFEATURE/\b\abase\a.]
900 [+?Generated \biffe\b headers are often referenced in C source as:
901 \b#include "FEATURE/\b\afile\a". The \bnmake\b(1) base rules contain
902 metarules for generating \bFEATURE/\b\afile\a from
903 \bfeatures/\b\afile\a[\asuffix\a]], where \asuffix\a may be omitted,
904 \b.c\b, or \b.sh\b (see the \brun\b test below). Because
905 \b#include\b prerequisites are automatically detected, \bnmake\b(1)
906 ensures that all prerequisite \biffe\b headers are generated before
907 compilation. Note that the directories are deliberately named
908 \bFEATURE\b and \bfeatures\b to keep case-ignorant file systems
910 [+?The feature tests are:]{
911 [+# \acomment\a?Comment line - ignored.]
912 [+api \aname\a \aYYYYMMDD\a \asymbol ...\a?Emit api compatibility tests
913 for \aname\a and \b#define\b \asymbol\a \asymbol\a_\aYYYYMMDD\a
914 when \aNAME\a_API is >= \aYYYYMMDD\a (\aNAME\a is \aname\a
915 converted to upper case). If \aNAME\a_API is not defined
916 then \asymbol\a maps to the newest \aYYYYMMDD\a for \aname\a.]
917 [+api \aname1\a = \aname2\a?Set the default \aname1\a api version to
918 the \aname2\a api version.]
919 [+define \aname\a [ (\aarg,...\a) ]] [ \avalue\a ]]?Emit a macro
920 \b#define\b for \aname\a if it is not already defined. The
921 definition is passed to subsequent tests.]
922 [+extern \aname\a \atype\a [ (\aarg,...\a) | [\adimension\a]] ]]?Emit
923 an \bextern\b prototype for \aname\a if one is not already
924 defined. The prototype is passed to subsequent tests.]
925 [+header \aheader\a?Emit \b#include <\b\aheader\a\b>\b if \aheader\a
926 exists. The \b#include\b is passed to subsequent tests.]
927 [+print \atext\a?Copy \atext\a to the output file. \atext\a is passed
928 to subsequent tests.]
929 [+reference \aheader\a?If \aheader\a exists then add \b#include\b
930 \aheader\a to subsequent tests.]
931 [+ver \aname\a \aYYYYMMDD\a?\b#define\b \aNAME\a_VERSION \aYYYYMMDD\a
932 (\aNAME\a is \aname\a converted to upper case).]
933 [+cmd \aname\a?Defines \b_cmd_\b\aname\a if \aname\a is an executable
934 in one of the standard system directories (\b/bin, /etc,
935 /usr/bin, /usr/etc, /usr/ucb\b).
936 \b_\b\adirectory\a\b_\b\aname\a is defined for \adirectory\a
937 in which \aname\a is found (with \b/\b translated to \b_\b).]
938 [+dat \aname\a?Defines \b_dat_\b\aname\a if \aname\a is a data symbol
939 in the default libraries.]
940 [+def \aname\a?Equivalent to \bcmd,dat,hdr,key,lib,mth,sys,typ\b
942 [+dfn \aname\a?If \aname\a is a macro in the candidate headers then
943 a \b#define\b \aname\a \avalue\a statment is output for the
944 \avalue\a defined in the headers. The definition is \b#ifndef\b
946 [+exp \aname\a \aexpression\a?If \aexpression\a is a \"...\" string
947 then \aname\a is defined to be the string, else if the
948 \bexpr\b(1) evaluation of \aexpression\a is not 0 then \aname\a
949 is defined to be 1, otherwise \aname\a is defined to be 0.
950 Identifiers in \aexpression\a may be previously defined names
951 from other \biffe\b tests; undefined names evaluate to 0.
952 If \aname\a was defined in a previous successful test then
953 the current and subsequent \bexp\b test on \aname\a are
954 skipped. If \aname\a is \b-\b then the \aexpression\a is
956 [+hdr \aname\a?Defines \b_hdr_\b\aname\a if the header
957 \b<\b\aname\a\b.h>\b exists. The \b--config\b macro name is
958 \bHAVE_\b\aNAME\a\b_H\b.]
959 [+if \astatement\a ... | \belif\b \astatement\a ... | \belse\b | \bendif\b?
960 Nested if-else test control.]
961 [+iff \aname\a?The generated header \b#ifndef-#endif\b macro guard is
962 \b_\b\aname\a\b_H\b.]
963 [+inc \afile\a [ re ]]?Read #define macro names from \afile\a
964 and arrange for those names to evaluate to 1 in \bexp\b
965 expressions. If \are\a is specified then macros not matching
967 [+key \aname\a?Defines \b_key_\b\aname\a if \aname\a is a reserved
969 [+lcl \aname\a?Generates a \b#include\b statement for the native version
970 of the header \b<\b\aname\a\b.h>\b if it exists. Defines
971 \b_lcl_\b\aname\a on success. The \b--config\b macro name is
972 \bHAVE_\b\aNAME\a\b_H\b. The default \are\a is \b^HAVE_\b
973 for \b--config\b and \b^_\b otherwise.]
974 [+lib \aname\a?Defines \b_lib_\b\aname\a if \aname\a is an external
975 symbol in the default libraries.]
976 [+mac \aname\a?Defines \b_mac_\b\aname\a if \aname\a is a macro.]
977 [+mem \astruct.member\a?Defines \b_mem_\b\amember\a\b_\b\astruct\a
978 if \amember\a is a member of the structure \astruct\a.]
979 [+mth \aname\a?Defines \b_mth_\b\aname\a if \aname\a is an external
980 symbol in the math library.]
981 [+nop \aname\a?If this is the first test then \aname\a may be used
982 to name the output file and/or the output header guard macro.
983 Otherwise this test is ignored.]
984 [+npt \aname\a?Defines \b_npt_\b\aname\a if the \aname\a symbol
985 requires a prototype. The \b--config\b macro name is
986 \bHAVE_\aNAME\a\b_DECL\b with the opposite sense.]
987 [+num \aname\a?Defines \b_num_\b\aname\a if \aname\a is a numeric
988 constant \aenum\a or \amacro\a.]
989 [+nxt \aname\a?Defines a string macro \b_nxt_\b\aname\a suitable for
990 a \b#include\b statement to include the next (on the include
991 path) or native version of the header \b<\b\aname\a\b.h>\b
992 if it exists. Also defines the \"...\" form
993 \b_nxt_\b\aname\a\b_str\b. The \b--config\b macro name is
994 \bHAVE_\b\aNAME\a\b_NEXT\b.]
995 [+one \aheader\a ...?Generates a \b#include\b statement for the first
996 header found in the \aheader\a list.]
997 [+opt \aname\a?Defines \b_opt_\b\aname\a if \aname\a is a space-separated
998 token in the global environment variable \bPACKAGE_OPTIONS\b.
999 \bopt no\b\a-name\a defines \b_opt_\b\aname\a if \bno\b-\aname\a
1000 is not a space-separated token in the global environment variable
1001 \bPACKAGE_OPTIONS\b.]
1002 [+pth \afile\a [ \adir\a ... | { \ag1\a - ... - \agn\a } | < \apkg\a [\aver\a ...]] > ]]?Defines
1003 \b_pth_\b\afile\a, with embedded \b/\b chars translated to
1004 \b_\b, to the path of the first instance of \afile\a in the
1005 \adir\a directories. \b{\b ... \b}\b forms a directory list
1006 from the cross-product of \b-\b separated directory groups
1007 \ag1\a ... \agn\a. < ... > forms a directory list for the
1008 package \apkg\a with optional versions. If no operands are
1009 specified then the default PATH directories are used. The
1010 \b--config\b macro name is \aNAME\a\b_PATH\b.]
1011 [+run \afile\a?Runs the tests in \afile\a based on the \afile\a
1013 [+.c?\afile\a is compiled and executed and the output is copied
1014 to the \biffe\b output file. Macros and headers supplied
1015 to \bbegin{\b ... \b}end\b are also supplied to
1017 [+.sh?\afile\a is executed as a shell script and the output is
1018 copied to the \biffe\b output file.]
1019 [+.iffe \bor no suffix?\afile\a contains \biffe\b
1022 [+set \aoption value\a?Sets option values. The options are described
1024 [+siz \aname\a?Defines \b_siz_\b\aname\a to be \bsizeof\b(\aname\a) if
1025 \aname\a is a type in any of \b<sys/types.h>, <times.h>,
1026 <stddef.h>, <stdlib.h>\b. Any \b.\b characters in \aname\a are
1027 translated to space before testing and are translated to \b_\b
1028 in the output macro name.]
1029 [+sym \aname\a?Defines \b_ary_\b\aname\a if \aname\a is an array,
1030 \b_fun_\b\aname\a if \aname\a is a function pointer,
1031 \b_ptr_\b\aname\a if \aname\a is a pointer, or
1032 \b_reg_\b\aname\a if \aname\a is a scalar. In most cases
1033 \aname\a is part of a macro expansion.]
1034 [+sys \aname\a?Defines \b_sys_\b\aname\a if the header
1035 \b<sys/\b\aname\a\b.h>\b exists. The \b--config\b macro name is
1036 \bHAVE_SYS_\b\aNAME\a\b_H\b.]
1037 [+tst \aname\a?A user defined test on name. A source block must be
1038 supplied. Defines \b_\b\aname\a on success. \btst - ...\b is
1039 treated as \btst - - ...\b.]
1040 [+typ \aname\a?Defines \b_typ_\b\aname\a if \aname\a is a type in any
1041 of \b<sys/types.h>, <times.h>, <stddef.h>, <stdlib.h>\b. Any
1042 \b.\b characters in \aname\a are translated to space before
1043 testing and are translated to \b_\b in the output macro name.]
1044 [+val \aname\a?The output of \becho\b \aname\a is written to the
1046 [+var \aname\a?A user defined test on name. A source block must be
1047 supplied. Sets the \bexp\b variable \b_\b\aname\a on success
1048 but does not define a macro.]
1049 [+(\aexpression\a)?Equivalent to \bexp -\b \aexpression\a.]
1051 [+?Code block names may be prefixed by \bno\b to invert the test sense. Any
1052 block that is eventually executed as a command will have a single
1053 command argument set to a temp file prefix that may be used to
1054 generate temp files for the test. The temp files/dirs are removed
1055 after the block execution. The block names are:]{
1056 [+cat?The block is copied to the output file.]
1057 [+compile?The block is compiled (\bcc -c\b).]
1058 [+cross?The block is executed as a shell script using \bcrossexec\b(1)
1059 if \b--cross\b is on, or on the local host otherwise, and the
1060 output is copied to the output file. Test macros are not
1061 exported to the script.]
1062 [+execute?The block is compiled, linked, and executed. \b0\b exit
1063 status means success.]
1064 [+fail?If the test fails then the block text is evaluated by
1066 [+link?The block is compiled and linked (\bcc -o\b).]
1067 [+macro?The block is preprocessed (\bcc -E\b) and lines containing
1068 text bracketed by \b<<"\b ... \b">>\b (\aless-than less-than
1069 double-quote ... double-quote greater-than greater-than\a)
1070 are copied to the output file with the brackets omitted.]
1071 [+no?If the test fails then the block text is copied to the
1072 output file. Deprecated: use { \bif\b \belif\b \belse\b
1073 \bendif\b } with unnamed \b{\b ... \b}\b blocks.]
1074 [+note?If the test succeeds then the block is copied to the output
1075 as a \b/*\b ... \b*/\b comment.]
1076 [+output?The block is compiled, linked, and executed, and the output
1077 is copied to the output file.]
1078 [+pass?If the test succeeds then the block text is evaluated by
1080 [+preprocess?The block is preprocessed (\bcc -E\b).]
1081 [+run?The block is executed as a shell script and the output is
1082 copied to the output file. Succesful test macros are also
1083 defined as shell variables with value \b1\b and are available
1084 within the block. Likewise, failed test macros are defined
1085 as shell variables with value \b0\b.]
1086 [+status?The block is compiled, linked, and executed, and the exit
1087 status is the test outcome, 0 for \afailure\a, the value
1089 [+yes?If the test succeeds then the block text is copied to the output
1090 file. \byes{\b ... \b}end\b is equivalent to the unnamed block
1091 \b{\b ... \b}\b. Deprecated: use { \bif\b \belif\b \belse\b
1092 \bendif\b } with unnamed \b{\b ... \b}\b blocks.]
1094 [+SEE ALSO?\bautoconf\b(1), \bconfig\b(1), \bgetconf\b(1), \bcrossexec\b(1),
1095 \bnmake\b(1), \bpackage\b(1), \bproto\b(1), \bsh\b(1)]
1097 while getopts -a "$command" "$USAGE" OPT
1099 a
) set="$set set all :" ;;
1100 c
) set="$set set cc $OPTARG :" ;;
1101 C
) set="$set set config :" ;;
1102 d
) set="$set set debug $OPTARG :" ;;
1103 D
) set="$set set define :" ;;
1104 E
) set="$set set explicit :" ;;
1105 F
) set="$set set features $OPTARG :" ;;
1106 i
) set="$set set input $OPTARG :" ;;
1107 I
) set="$set set include $OPTARG :" ;;
1108 L
) set="$set set library $OPTARG :" ;;
1109 n
) set="$set set namval $OPTARG :" ;;
1110 N
) set="$set set nooptimize $OPTARG :" ;;
1111 o
) set="$set set output $OPTARG :" ;;
1112 e
) set="$set set package $OPTARG :" ;;
1113 p
) set="$set set prototyped :" ;;
1114 P
) set="$set set pragma $OPTARG :" ;;
1115 r
) set="$set set regress :" ;;
1116 s
) set="$set set shell $OPTARG :" ;;
1117 S
) set="$set set static $OPTARG :" ;;
1118 O
) set="$set set stdio $OPTARG :" ;;
1119 u
) set="$set set undef :" ;;
1120 v
) set="$set set verbose :" ;;
1121 x
) set="$set set cross $OPTARG :" ;;
1122 X
) set="$set set exclude $OPTARG :" ;;
1125 shift `expr $OPTIND - 1`
1140 --cc=*) REM
=c
`echo X$1 | sed 's,[^=]*=,,'`
1142 --co|
--con|
--conf|
--confi|
--config)
1145 --cr=*|
--cro=*|
--cros=*|
--cross=*)
1146 REM
=x
`echo X$1 | sed -e 's,[^=]*=,,'`
1148 --d=*|
--de=*|
--deb=*|
--debu=*|
--debug=*)
1149 REM
=d
`echo X$1 | sed 's,[^=]*=,,'`
1151 --def|
--defi|
--defin|
--define)
1154 --e=*|
--ex=*|
--exc=*|
--excl=*|
--exclu=*|
--exclud=*|
--exclude=*)
1155 REM
=X
`echo X$1 | sed 's,[^=]*=,,'`
1157 --e|
--ex|
--exp|
--expl|
--expli|
--explic|
--explici|
--explicit)
1160 --f=*|
--fe=*|
--fea=*|
--feat=*|
--featu=*|
--featur=*|
--feature=*|
--features=*)
1161 REM
=F
`echo X$1 | sed 's,[^=]*=,,'`
1163 --inp=*|
--inpu=*|
--input=*)
1164 REM
=i
`echo X$1 | sed 's,[^=]*=,,'`
1166 --inc=*|
--incl=*|
--inclu=*|
--includ=*|
--include=*)
1167 REM
=I
`echo X$1 | sed 's,[^=]*=,,'`
1169 --l=*|
--li=*|
--lib=*|
--libr=*|
--libra=*|
--librar=*|
--library=*)
1170 REM
=L
`echo X$1 | sed 's,[^=]*=,,'`
1172 --n|
--na|
--nam|
--name|
--name-v|
--name-va|
--name-val|
--name-valu|
--name-value)
1175 --o=*|
--ou=*|
--out=*|
--outp=*|
--outpu=*|
--output=*)
1176 REM
=o
`echo X$1 | sed 's,[^=]*=,,'`
1178 --pa=*|
--pac=*|
--pack=*|
--packa=*|
--packag=*|
--package=*)
1179 REM
=e
`echo X$1 | sed 's,[^=]*=,,'`
1181 --pro|
--prot|
--proto|
--protot|
--prototy|
--prototyp|
--prototype|
--prototyped)
1184 --pra=*|
--prag=*|
--pragma=*)
1185 REM
=P
`echo X$1 | sed 's,[^=]*=,,'`
1187 --r|
--re|
--reg|
--regre|
--regres|
--regress)
1190 --sh=*|
--she=*|
--shel=*|
--shell=*)
1191 REM
=s
`echo X$1 | sed 's,[^=]*=,,'`
1193 --sta=*|
--stat=*|
--stati=*|
--static=*)
1194 REM
=S
`echo X$1 | sed 's,[^=]*=,,'`
1196 --std=*|
--stdi=*|
--stdio=*)
1197 REM
=O
`echo X$1 | sed 's,[^=]*=,,'`
1199 --u|
--un|
--und|
--unde|
--undef)
1202 --v|
--ve|
--ver|
--verb|
--verbo|
--verbos|
--verbose)
1205 --*) echo $command: $1: unknown option
>&2
1208 -*) REM
=`echo X$1 | sed 's,X-,,'`
1218 eval `echo $REM | sed "s,\(.\)\(.*\),OPT='\1' REM='\2',"`
1223 0) echo $command: -$OPT: option argument expected
>&2
1236 a
) set="$set set all :" ;;
1237 c
) set="$set set cc $OPTARG :" ;;
1238 C
) set="$set set config :" ;;
1239 d
) set="$set set debug $OPTARG :" ;;
1240 D
) set="$set set define :" ;;
1241 E
) set="$set set explicit :" ;;
1242 F
) set="$set set features $OPTARG :" ;;
1243 i
) set="$set set input $OPTARG :" ;;
1244 I
) set="$set set include $OPTARG :" ;;
1245 L
) set="$set set library $OPTARG :" ;;
1246 n
) set="$set set namval $OPTARG :" ;;
1247 N
) set="$set set nooptimize $OPTARG :" ;;
1248 o
) set="$set set output $OPTARG :" ;;
1249 e
) set="$set set package $OPTARG :" ;;
1250 p
) set="$set set prototyped :" ;;
1251 P
) set="$set set pragma $OPTARG :" ;;
1252 r
) set="$set set regress :" ;;
1253 s
) set="$set set shell $OPTARG :" ;;
1254 S
) set="$set set static $OPTARG :" ;;
1255 O
) set="$set set stdio $OPTARG :" ;;
1256 u
) set="$set set undef :" ;;
1257 v
) set="$set set verbose :" ;;
1258 x
) set="$set set cross $OPTARG :" ;;
1259 X
) set="$set set exclude $OPTARG :" ;;
1260 *) echo "Usage: $command [-aCDEnpruv] [-c C-compiler-name [C-compiler-flags ...]] [-d level]
1261 [-F features-header] [-i file] [-o file] [-O stdio-header] [-e name] [-P text]
1262 [-s shell-path] [-S[flags]] [-x cross-exec-prefix] [-I dir] [-L dir] [-X dir] [ - ]
1263 [ file.iffe | statement [ : statement ... ] ]" >&2
1279 *' set config '*|
*' run config.'*|
*' run '*' config.'*|
*' run '*'/config.'*)
1284 # standard error to /dev/null unless debugging
1285 # standard output to the current output file
1287 # stdout original standard output
1288 # stderr original standard error
1289 # nullin /dev/null input
1290 # nullout /dev/null output
1292 stdout
=5 stderr
=6 nullin
=7 nullout
=8
1293 eval "exec $nullin</dev/null $nullout>/dev/null $stdout>&1 $stderr>&2"
1295 *" set debug "[3456789]*)
1297 *) eval "exec 2>&$nullout"
1301 # prompt complications
1303 case `print -n aha </dev/null 2>/dev/null` in
1304 aha
) show
='print -n' SHOW
='' ;;
1305 *) case `echo -n aha 2>/dev/null` in
1306 -n*) show
=echo SHOW
='\c' ;;
1307 *) show
='echo -n' SHOW
='' ;;
1312 # tmp files cleaned up on exit
1313 # status: 0:success 1:failure 2:interrupt
1319 *) if (ulimit -c 0) >/dev
/null
2>&1
1322 else core
="core core.??*"
1326 trap "rm -rf $core $tmp*" 0
1327 if (:>$tmp.c
) 2>/dev
/null
1329 else echo "$command: cannot create tmp files in current dir" >&2
1334 # standard header for c source
1336 std
='#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
1345 #if defined(__cplusplus)
1346 #define _BEGIN_EXTERNS_ extern "C" {
1347 #define _END_EXTERNS_ }
1349 #define _BEGIN_EXTERNS_
1350 #define _END_EXTERNS_
1352 #define _NIL_(x) ((x)0)'
1354 ext
="#include <stdio.h>"
1355 noext
='*[<"][Ss][Tt][Dd][Ii][Oo].[Hh][">]*|*<ast.h>*|*<sfio.h>*|*/[*]<NOSTDIO>[*]/*'
1357 # loop on op [ arg [ ... ] ] [ : op [ arg [ ... ] ] ]
1375 "") case $argx:$
* in
1386 ksh
) let line
=line
+1 ;;
1387 *) line
=`expr $line + 1` ;;
1421 ?
*) echo "$command: $file$line: missing endif" >&$stderr
1433 "if") ifstack
="$ifelse:$ifstack"
1444 1) set '' - "$@"; shift ;;
1447 "elif") case $ifelse in
1453 NONE
) echo "$command: $file$line: $1: no matching if" >&$stderr
1459 1) set '' - "$@"; shift ;;
1462 "else") case $ifelse in
1468 NONE
) echo "$command: $file$line: $1: no matching if" >&$stderr
1474 "endif")case $ifelse in
1475 NONE
) echo "$command: $file$line: $1: no matching if" >&$stderr
1480 ksh
) ifelse
=${ifstack%%:*}
1481 ifstack
=${ifstack#*:}
1483 *) eval `echo $ifstack | sed 's,\([^:]*\):\(.*\),ifelse=\1 ifstack=\2,'`
1493 # check if "run xxx" is equivalent to "set in xxx"
1496 "("*) set exp
- "$@" ;;
1497 *.iffe|
*.iff
) set run
"$@" ;;
1505 */*) x
=`echo $2 | sed 's,.*[\\\\/],,'` ;;
1509 *) eval 'x=${2##*[\\/]}'
1521 # { inc set } drop out early
1526 inc
) case $ifelse in
1527 DONE|SKIP
) set ''; shift; continue ;;
1531 0) echo "$command: $file$line: path expected" >&$stderr
1538 then echo "$command: $file$line: $p: file not found" >&$stderr
1550 echo "$command: $file$line: warning: $*: operands ignored" >&$stderr
1553 eval `sed -e '/^#define[ ]/!d' -e 's/#define[ ]//' -e 's/[ (].*//' ${e:+"-e/$e/!d"} -e 's/.*/&=1/' $p | LC_ALL=C sort -u`
1556 set) case $ifelse in
1557 DONE|SKIP
) set ''; shift; continue ;;
1567 bsh
) op
=`echo X$op | sed 's/X--//'` ;;
1572 -??
*) case $shell in
1573 bsh
) arg
=`echo X$op | sed 's/X-.//'`
1574 op
=`echo X$op | sed 's/X\\(-.\\).*/\\1/'`
1643 export `echo $x | sed 's/=.*//'`
1649 -O*) case $optimize in
1669 *) cross
="$arg" libpaths
= ;;
1680 ""|
1) exec 2>&$stderr
1685 2|
3) exec 2>&$stderr
1687 ksh
) eval 'PS4="${PS4%+*([ ])}+\$LINENO+ "'
1693 *) echo "$command: $arg: debug levels are 0, 1, 2, 3" >&$stderr
1701 exclude
)case $arg in
1703 *) excludes
="$excludes $arg" ;;
1705 exclude includes occ
1712 features
)case $arg in
1714 *) tst
="#include \"$arg\"" ;;
1724 then echo "$command: $in: not found" >&$stderr
1733 bsh
) eval `echo $in | sed -e 's,.*[\\\\/],,' -e 's/\\.[^.]*//' -e 's/^/out=/'`
1735 *) eval 'out=${in##*[\\/]}'
1736 eval 'out=${out%.*}'
1749 include
)case $arg in
1751 *) includes
="$includes -I$arg" ;;
1756 library
)for y
in $libpaths
1757 do eval $y=\"\$
$y:\
$arg\$
${y}_default
\"
1765 nodebug
)exec 2>&$nullout
1776 *" -O"*)occ
=`echo $occ | sed 's/ -O[^ ]*//g'`
1798 package
)protoflags
="$protoflags -e $arg"
1801 prototyped|noprototyped
)
1802 pragma
="$pragma $op"
1804 prototyped
) prototyped
=1 ;;
1809 pragma
) pragma
="$pragma $arg"
1840 echo "#include \"$i\"" > t.c
1841 if $cc -E t.c
> /dev
/null
2>&1
1842 then ext
="$ext$sep#include \"$arg\""
1856 *) echo "$command: $op: unknown option" >&$stderr
1861 api|define|extern|header|include|print|reference|ver
)
1890 '('*|
'"'*'"'|
'<'*'>')
1939 '('*|
*'{'|
'"'*'"'|
'<'*'>')
1952 -*|
+*|
'('*|
*'{'|
'"'*'"'|
'<'*'>')
1964 '('*|
'"'*'"'|
'<'*'>')
1974 *) test="$test $1" ;;
2012 [abcdefghijklmnopqrstuvwxyz
]*'{'|
'{')
2029 0) case $posix_read in
2033 "") echo "$command: $file$line: missing }end" >&$stderr
2038 do case $posix_read in
2040 ksh
) IFS
= read -r lin
2043 do lin
="${lin#[' ']}"
2055 [' ']*) lin
=`sed -e 's,^[ ],,' -e 's,^[ ]*#,#,' <<!
2064 *) lin
=`$posix_read`
2070 ksh
) let line
=line
+1 ;;
2071 *) line
=`expr $line + 1` ;;
2079 *) n
=`expr $n + 1` ;;
2090 *) n
=`expr $n - 1` ;;
2097 *) echo "$command: $file$line: missing $e" >&$stderr
2107 *) n
=`expr $n + 1` ;;
2116 *) n
=`expr $n - 1` ;;
2126 *) x
="$x$nl" # \r\n bash needs this barf # ;;
2130 'nofail{') pass
=$x v
='pass{' ;;
2131 'nopass{') fail
=$x v
='fail{' ;;
2136 'yes{'|
'{') yes=$x ;;
2143 *[\"\'\
(\
)\
{\
}\ \
]*)
2149 *) test="$test $1" ;;
2163 *) groups
="$groups $1"
2168 --*) groups
="$groups $1" ;;
2173 bsh
) x
=`echo X$1 | sed 's/X+/-/'` ;;
2174 *) eval 'x=-${1#+}' ;;
2177 --*) groups
="$groups $x" ;;
2187 *) x
=`echo x$1 | sed 's,^x-L,,'` ;;
2190 do eval $y=\"\$
$y:\
$x\$
${y}_default
\"
2197 --*) groups
="$groups $1"
2203 -D*) mac
="$mac $1" ;;
2213 *.
[aAxX
]|
*.
[dD
][lL
][lL
]|
*.
[lL
][iI
][bB
])
2215 --*) groups
="$groups $1" ;;
2221 --*) groups
="$groups $1"
2224 pth
) pth
="$pth $1" ;;
2231 --*) groups
="$groups $1"
2238 *) test="$test $1" ;;
2256 DONE|SKIP
) continue ;;
2259 # make sure $cc compiles C
2262 "") cc
="$occ $includes" ;;
2268 # some ops allow no args
2274 [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
]*:[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]:*)
2281 eval api_sym_
${a}= api_ver_
${a}=
2290 [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])
2305 eval syms
='$'api_sym_
${a}
2311 do syms
=$syms$sep${1}:${r}
2314 eval api_sym_
${a}='$'syms
2318 [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
]*:=:[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
]*)
2319 apisame
="$apisame $1 $3"
2321 *) echo "$command: $op: expected: name YYYYMMDD symbol ..." >&$stderr
2336 comment
)copy
- "/* $* */"
2372 if compile
$cc -c $tmp.c
<&$nullin >&$nullout
2375 copy
- "#define $x$arg $v"
2376 usr
="$usr${nl}#define $x$arg $v"
2387 #include <sys/types.h>
2390 struct _iffe_struct { int _iffe_member; };
2391 extern struct _iffe_struct* $x _ARG_((struct _iffe_struct*));
2394 # some compilers with -O only warn for invalid intrinsic prototypes
2396 *" -O "*) xx
=`echo $cc | sed 's/ -O / /g'` ;;
2399 if compile
$xx -c $tmp.c
<&$nullin >&$nullout
2427 copy
- "extern $t $x$v;"
2428 # NOTE: technically if prototyped is on all tests should
2429 # be run through proto(1), but we'd like iffe to
2430 # work sans proto -- so we drop the extern's in
2433 '') usr
="$usr${nl}extern $t $x$v;" ;;
2450 header|include|reference
)
2465 *"# include <"$x">"*)
2470 *) copy
- "#include <$x>"
2473 usr
="$usr${nl}#include <$x>"
2477 *) copy
$tmp.c
"$std
2483 then gothdr
="$gothdr + $x"
2487 *) copy
- "#include <$x>"
2490 usr
="$usr${nl}#include <$x>"
2491 else gothdr
="$gothdr - $x"
2521 [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
]*:[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])
2525 *) echo "$command: $op: expected: name YYYYMMDD" >&$stderr
2550 #define NOTE(s) do{write(9,\" \",1);write(9,s,strlen(s));write(9,\" ...\",4);}while(0)"
2556 # save $* for ancient shells
2561 # loop on all candidate groups
2565 # check the candidate macros
2569 # check for global default headers (some cc -E insist on compiling)
2579 ksh
) typeset
-u u
=$x ;;
2580 *) u
=`echo $x | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
2586 echo "${allinc}#include <$x>" > $tmp.c
2588 then gothdr
="$gothdr + $x"
2590 0) can
="$can$cansep#define $c 1 /* #include <$x> ok */"
2591 nan
="$nan$cansep$c=1"
2596 allinc
="${allinc}#include <$x>$nl"
2597 else gothdr
="$gothdr - $x"
2598 case $explicit$all$config$undef in
2600 can
="$can$cansep#undef $c /* #include <$x> not ok */"
2601 nan
="$nan$cansep$c="
2604 01??
) can
="$can$cansep#define $c 0 /* #include <$x> not ok */"
2605 nan
="$nan$cansep$c=0"
2614 # add implicit headers/libraries before the checks
2617 npt
) hdr
="sys/types.h stdlib.h unistd.h $hdr"
2619 siz|typ
)hdr
="sys/types.h time.h sys/time.h sys/times.h stddef.h stdlib.h $hdr"
2623 # check the candidate headers
2631 *.h
) case " $gothdr " in
2638 bsh
) eval `echo $x | sed -e 's,^\\([^\\\\/]*\\).*[\\\\/]\\([^\\\\/]*\\)\$,\\1_\\2,' -e 's/\\..*//' -e 's/^/c=/'`
2640 *) eval 'c=${x##*[\\/]}'
2643 */*) eval 'c=${x%%[\\/]*}_${c}' ;;
2667 ksh
) typeset
-u u
=$c ;;
2668 *) u
=`echo $c | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
2673 echo "${allinc}#include <$x>" > $tmp.c
2675 then gothdr
="$gothdr + $x"
2677 0) can
="$can$cansep#define $c 1 /* #include <$x> ok */"
2678 nan
="$nan$cansep$c=1"
2683 else gothdr
="$gothdr - $x"
2684 case $dis$all$config$undef in
2686 can
="$can$cansep#undef $c /* #include <$x> not ok */"
2687 nan
="$nan$cansep$c="
2690 01??
) can
="$can$cansep#define $c 0 /* #include <$x> not ok */"
2691 nan
="$nan$cansep$c=0"
2700 *) test -r $x ||
continue
2708 # check the candidate libraries
2718 echo "int main(){return(0);}" > $tmp.c
2732 if compile
$cc -o $tmp.exe
$tmp.c
$p $lib <&$nullin >&$nullout
2734 gotlib
="$gotlib + $p"
2748 *" $l "*) continue ;;
2754 if compile
$cc -o $tmp.exe
$tmp.c
$a <&$nullin >&$nullout
2756 gotlib
="$gotlib + $p"
2766 gotlib
="$gotlib - $p"
2773 bsh
) c
=`echo X$x | sed 's,X-l,,'` ;;
2774 *) eval 'c=${x#-l}' ;;
2777 *[!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_
]*)
2778 c
=`echo '' $c | sed -e 's,.*[\\\\/],,' -e 's,\.[^.]*$,,' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g' -e '/^lib./s,^lib,,'`
2783 0*' '*) case " $gotlib " in
2786 *) can
="$can$cansep#define _LIB_$c 1 /* $x is a library */"
2787 nan
="$nan${cansep}_LIB_$c=1"
2796 ksh
) typeset
-u u
=$c ;;
2797 *) u
=`echo $c | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
2801 0*' '*) case " $gotlib " in
2804 *) can
="$can$cansep#define HAVE_${c}_LIB 1 /* $x is a library */"
2805 nan
="$nan${cansep}HAVE_${c}_LIB=1"
2807 eval HAVE_
${c}_LIB
=1
2818 1) c
=HAVE
${y}_LIB
;;
2821 *' '*) q
="a library group" ;;
2825 0) can
="$can$cansep#define $c 1 /* $p is $q */"
2826 nan
="$nan$cansep$c=1"
2833 1) case $all$config$undef in
2834 ?
1?|??
1)can
="$can$cansep#undef $c /* $p is not $q */"
2835 nan
="$nan$cansep$c="
2838 1??
) can
="$can$cansep#define $c 0 /* $p is not $q */"
2839 nan
="$nan$cansep$c=0"
2856 ref
) deflib
="$deflib $lib"
2857 defhdr
="$defhdr $hdr"
2872 # check for op aliases
2877 def|default
) x
="$x cmd dat hdr key lib mth sys typ" ;;
2882 # loop on the ops o and args a
2891 hdr|lcl|nxt|pth|sys
)
2899 bsh
) eval `echo $x | sed 's,\\(.*\\)\.\\([^.]*\\),x=\\1 o=\\2,'`
2909 *[\\/]*)case $shell in
2910 bsh
) eval `echo $x | sed 's,\\(.*\\)[\\\\//]\\(.*\\),p=\\1 v=\\2,'`
2918 bsh
) eval `echo $x | sed 's,\\(.*\\)\\.\\(.*\\),p=\\1 v=\\2,'`
2934 bsh
) eval `echo $a | sed -e 's,.*[\\\\/],,' -e 's/\\(.*\\)\\.\\(.*\\)/p=\\1 v=\\2/'`
2937 eval 'p=${p##*[\\/]}'
2939 eval 'v=${v##*[\\/]}'
2955 bsh
) eval `echo $p | sed 's/\\([^.]*\\)\\.\\(.*\\)/p=\\1 m=\\2/'`
2965 1) m
=_
${v}_in_
${p} ;;
2994 *) case " $idyes " in
2998 *) case " $idno " in
3003 *'*') m
=`echo "$m" | sed 's,\*,_ptr,g'` ;;
3009 *[!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_
]*)
3011 copy
$tmp.c
"int $m = 0;"
3012 if compile
$cc -c $tmp.c
3028 dat|dfn|key|lib|mac|mth|nos|npt|siz|sym|typ|val
)
3039 *[!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_
]*)
3040 m
=`echo "X$m" | sed -e 's,^.,,' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g'`
3044 # check output redirection
3055 do API
=`echo $api | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
3056 eval ver
='${'ver_${api}'}'
3057 echo "#define ${API}_VERSION ${ver}"
3066 echo "#ifndef _API_${1}"
3067 echo "#define _API_${1} _API_${2}"
3071 ?
*) for api
in $apis
3072 do API
=`echo $api | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
3073 echo "#define ${API}API(rel) ( _BLD_${api} || !_API_${api} || _API_${api} >= rel )"
3075 echo "#ifndef _${API}_API_IMPLEMENT"
3076 echo "#define _${API}_API_IMPLEMENT 1"
3080 eval syms
='"${'api_sym_${api}'}"'
3081 # old solaris requires -k<space><junk> #
3082 set x x
`echo "$syms" | sort -t: -u -k 1,1 -k 2,2nr 2>/dev/null | sed 's/:/ /'`
3084 2) # ancient sort doesn't have -k #
3085 set x x
`echo "$syms" | sort -t: -u +0 -1 +1 -2nr 2>/dev/null | sed 's/:/ /'`
3098 $sym) echo "#elif _API_${api} >= $rel"
3102 echo "#if !defined(_API_${api}) && defined(_API_DEFAULT)"
3103 echo "#define _API_${api} _API_DEFAULT"
3110 echo "#if ${API}API($rel)"
3113 echo "#undef ${sym}"
3114 echo "#define ${sym} ${sym}_${rel}"
3115 map
=$map$sep${sym}_
${rel}
3120 echo "#define _API_${api}_MAP \"$map\""
3128 ?
*) echo "#endif" ;;
3134 *[\\/]*|
*.h
) x
=$cur ;;
3138 n
) sed '/^#/d' $tmp.h
> $tmp.c
3139 sed '/^#/d' $x > $tmp.t
3141 *) (proto
-r $protoflags $tmp.h
) >/dev
/null
2>&1
3142 sed 's,/\*[^/]*\*/, ,g' $tmp.h
> $tmp.c
3143 sed 's,/\*[^/]*\*/, ,g' $x > $tmp.t
3146 if cmp -s $tmp.c
$tmp.t
3149 1) echo "$command: $x: unchanged" >&$stderr ;;
3152 ${dir}[\\/]$cur) test -d $dir || mkdir
$dir ||
exit 1 ;;
3167 -) eval "exec >&$stdout"
3174 *[\\/]*|???????????????
*) cur
=$c ;;
3183 run
) x
=" from $a" ;;
3191 # output header comments
3195 ?
) echo "/* : : generated$x by $command version $version : : */"
3197 do echo "#pragma $x"
3203 bsh
) eval `echo $in | sed -e 's,\\.,_,g' -e 's/^/x=/'`
3209 *.
*) eval 'x=$x${i%%.*}_'
3232 *) x
=`pwd | sed -e 's,.*[\\\\/],,' -e 's,\\..*,,' -e 's,^lib,,' -e 's,^,'${x}_',' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g'`
3233 # ksh n+ bug workaround
3252 ?
*) echo "#ifndef $iff"
3253 echo "#define $iff 1"
3273 # set up the candidate include list
3277 for x
in $defhdr - $hdr
3283 *.
*) for x
in `echo $v | sed 's,\\., ,g'`
3290 char|short|int|long
)
3303 bsh
) eval `echo $x | sed -e 's,^\\([^\\\\/]*\\).*[\\\\/]\\([^\\\\/]*\\)\$,\\1_\\2,' -e 's/\\..*//' -e 's/^/c=/'`
3305 *) eval 'c=${x##*[\\/]}'
3308 */*) eval 'c=${x%%[\\/]*}_${c}' ;;
3319 ksh
) typeset
-u u
=$c ;;
3320 *) u
=`echo $c | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
3328 *) puthdr
="$puthdr $c"
3329 usr
="$usr$nl#define $c 1"
3338 # set up the candidate lib list
3340 for x
in $lib $deflib
3342 ksh
) eval 'c=${x#-l}' ;;
3343 *) c
=`echo X$x | sed 's,X-l,,'` ;;
3346 *[!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_
]*)
3347 c
=`echo '' $c | sed -e 's,.*[\\\\/],,' -e 's,\.[^.]*$,,' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g' -e '/^lib./s,^lib,,'`
3354 ksh
) typeset
-u u
=$c ;;
3355 *) u
=`echo $c | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
3363 *) putlib
="$putlib $c"
3364 usr
="$usr$nl#define $c 1"
3369 # src overrides builtin test
3371 case $config:$def in
3381 ksh
) typeset
-u u
=$m ;;
3382 *) u
=`echo $m | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
3391 *) u
=`echo $u | sed 's/....//'` ;;
3399 dat
) m
=HAVE
${u}_DATA
;;
3400 hdr|lcl
)m
=HAVE
${u}_H
;;
3401 key
) m
=HAVE
${u}_RESERVED
;;
3402 mth
) m
=HAVE
${u}_MATH
;;
3403 npt
) m
=HAVE
${u}_DECL
;;
3407 *) m
=`echo $m | sed 's,^_,,'` ;;
3410 nxt
) m
=HAVE
${u}_NEXT
;;
3411 siz
) m
=SIZEOF
${u} ;;
3412 sys
) m
=HAVE_SYS
${u}_H
;;
3435 is tst
"${note:-$run}"
3443 execute
$tmp.sh
<&$nullin || e
=1
3446 (eval "$src") <&$nullin || e
=1
3449 if compile
$cc -E $tmp.c
<&$nullin >$tmp.i
3450 then sed -e '/<<[ ]*".*"[ ]*>>/!d' -e 's/<<[ ]*"//g' -e 's/"[ ]*>>//g' $tmp.i
3454 p
*|nop
*)compile
$cc -DTEST=$p -DID=$v -E $tmp.c
<&$nullin >&$nullout || e
=1
3456 c
*|noc
*)compile
$cc -DTEST=$p -DID=$v -c $tmp.c
<&$nullin >&$nullout || e
=1
3461 s
*|nos
*)case $reallystatictest in
3467 int main(){printf("hello
");return(0);}" > ${tmp}s.c
3469 if compile
$cc -c ${tmp}s.c
<&$nullin >&$nullout &&
3470 compile
$cc -o ${tmp}s.exe ${tmp}s.o <&$nullin >&$nullout 2>${tmp}s.e
&&
3471 $executable ${tmp}s.exe
3472 then e
=`wc -l ${tmp}s.e`
3473 eval set x x
$binding
3481 compile
$cc -o ${tmp}s.exe $1 ${tmp}s.o <&$nullin >&$nullout 2>${tmp}s.e && $executable ${tmp}s.exe ||
continue
3482 case `wc -l ${tmp}s.e` in
3486 d
=`ls -s ${tmp}s.exe`
3488 compile
$cc -o ${tmp}s.exe $2 ${tmp}s.o <&$nullin >&$nullout 2>${tmp}s.e && $executable ${tmp}s.exe ||
continue
3489 case `wc -l ${tmp}s.e` in
3493 case `ls -s ${tmp}s.exe` in
3507 ccflags
=$reallystatic
3528 if compile
$cc $ccflags $o -DTEST=$p -DID=$v -o $tmp.exe
$tmp.c
$lib $deflib <&$nullin >&$nullout && $executable $tmp.exe
3531 status
*)execute
$tmp.exe
<&$nullin >&$nullout
3540 [ls]*) e
=0 && break ;;
3541 noo
*) execute
$tmp.exe
<&$nullin >$tmp.out ||
break ;;
3542 o
*) execute
$tmp.exe
<&$nullin >$tmp.out
&& e
=0 && break ;;
3543 no
*) execute
$tmp.exe
<&$nullin >&$nullout ||
break ;;
3544 *) execute
$tmp.exe
<&$nullin >&$nullout && e
=0 && break ;;
3548 no
[els
]*)e
=1 && break ;;
3576 report
$e $V "${note:-$run\ passed}" "${note:-$run} failed"
3581 # initialize common builtin state
3586 "") statictest
=FoobaR
3593 extern int $statictest;
3595 int main(){char* i = (char*)&$statictest; return ((unsigned int)i)^0xaaaa;}
3598 if compile
$cc -o $tmp.exe
$tmp.c
<&$nullin >&$nullout && $executable $tmp.exe
3599 then case $static in
3604 int main(){printf("hello
");return(0);}
3607 if compile
$cc -c $tmp.c
<&$nullin >&$nullout &&
3608 compile
$cc -o $tmp.exe
$tmp.o
<&$nullin >&$nullout &&
3609 $executable $tmp.exe
3610 then e
=`wc -l $tmp.e`
3611 eval set x x
$binding
3619 compile
$cc -o $tmp.exe
$1 $tmp.o
<&$nullin >&$nullout && $executable $tmp.exe ||
continue
3620 case `wc -l $tmp.e` in
3626 compile
$cc -o $tmp.exe
$2 $tmp.o
<&$nullin >&$nullout && $executable $tmp.exe ||
continue
3627 case `wc -l $tmp.e` in
3631 case `ls -s $tmp.exe` in
3664 for i
in bin etc ucb
3665 do if test -f $d/$i/$a
3670 *) usr
="$usr$nl#define $m 1"
3672 1) echo "#define $m 1 /* $a in ?(/usr)/(bin|etc|ucb) */" ;;
3680 usr
="$usr$nl#define $c 1"
3682 1) echo "#define $c 1 /* $d/$i/$a found */" ;;
3707 *) echo "_BEGIN_EXTERNS_
3718 int main(){char* i = (char*) _REF_ $v; return ((unsigned int)i)^0xaaaa;}"
3722 compile
$cc -c $tmp.c
<&$nullin >&$nullout &&
3723 compile
$cc $static -o $tmp.exe
$tmp.o
$lib $deflib <&$nullin >&$nullout &&
3724 $executable $tmp.exe
3725 report $?
1 "$v in default lib(s)" "$v not in default lib(s)"
3737 <<\"#define $v\">> $v <<\"/* native $v */\">>
3740 if compile
$cc -E $tmp.c
<&$nullin >$tmp.i
3741 then sed -e '/<<[ ]*".*"[ ]*>>/!d' -e 's/<<[ ]*"//g' -e 's/"[ ]*>>//g' $tmp.i
> $tmp.t
3751 '') echo "$command: $file$sline: test expression expected for $o" >&$stderr
3766 [01]|
'"'*'"'|
'<'*'>')
3769 *) case $define$note in
3770 1) echo "#define $a $test" ;;
3771 1*) echo "#define $a $test /* $note */" ;;
3772 n
) echo "$a=$test" ;;
3786 for i
in `echo '' $test | sed 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_], & ,g'`
3790 [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_
]*)
3816 c
=`eval expr $x 2>&$stderr`
3825 report
$c 1 "$note is true" "$note is false"
3844 #include <$f.h>" > $tmp.c
3846 if compile
$cc -E $tmp.c
<&$nullin >$tmp.i
3848 for i
in `grep '^#.*".*'$f'\\.h"' $tmp.i | head -1 | sed -e 's;.*"\\(.*\\)[\\\\\/]'$f'\\.h".*;\\1;' -e 's;/; ;g' -e 's/^ *[^ ]*//'`
3858 #include \"$k\"" > $tmp.c
3859 if compile
$cc -E $tmp.c
<&$nullin >$tmp.i
3869 #include \"/$k\"" > $tmp.c
3870 if compile
$cc -E $tmp.c
<&$nullin >&$nullout
3876 #include \"../include/$f.h\"" > $tmp.c
3877 if compile
$cc -E $tmp.c
<&$nullin >&$nullout
3878 then r
=..
/include
/$f.h
3888 lcl
) case $all$config$undef in
3889 ?
1?|??
1)echo "#undef $m /* no native <$f.h> */" ;;
3890 1??
) echo "#define $m 0 /* no native <$f.h> */" ;;
3894 nxt
) case $all$config$undef in
3895 ?
1?|??
1)echo "#undef $m /* no include path for the native <$f.h> */" ;;
3900 [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
]:[\\/]*|
[\\/]*)
3903 lcl
) echo "#if defined(__STDPP__directive)"
3904 echo "__STDPP__directive pragma pp:hosted"
3906 echo "#include \"$r\" /* the native <$f.h> */"
3908 usr
="$usr$nl#define $m 1"
3911 nxt
) echo "#define $m \"$r\" /* include path for the native <$f.h> */"
3912 echo "#define ${m}_str \"$r\" /* include string for the native <$f.h> */"
3913 usr
="$usr$nl#define $m \"$r\"$nl#define ${m}_str \"$r\""
3921 lcl
) echo "#include \"$r\" /* the native <$f.h> */"
3923 usr
="$usr$nl#define $m 1"
3927 nxt
) echo "#define $m \"$r\" /* include path for the native <$f.h> */"
3928 echo "#define ${m}_str \"$r\" /* include string for the native <$f.h> */"
3929 usr
="$usr$nl#define $m \"$r\"$nl#define ${m}_str \"$r\""
3953 #include <$x>" > $tmp.c
3955 then gothdr
="$gothdr + $x"
3958 *) case " $puthdr " in
3961 *) puthdr
="$puthdr $m"
3962 usr
="$usr$nl#define $m 1"
3966 1) echo "#define $m 1 /* #include <$x> ok */" ;;
3972 else gothdr
="$gothdr - $x"
3975 *) case $define$all$config$undef in
3976 1?
1?|
1??
1)echo "#undef $m /* #include <$x> not ok */" ;;
3977 11??
) echo "#define $m 0 /* #include <$x> not ok */" ;;
3979 n1??
) echo "$m=0" ;;
4002 int f(){int $w = 1;return($w);}" > $tmp.c
4003 if compile
$cc -c $tmp.c
<&$nullin >&$nullout
4034 ksh
) typeset
-u u
=$w ;;
4035 *) u
=`echo $w | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
4040 *[!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_
]*)
4041 M
=`echo "X$m" | sed -e 's,^.,,' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g'`
4045 1) m
=HAVE
${u}_RESERVED
;;
4051 report
- 1 - - "$w is not a reserved keyword" "default for reserved keyword $v"
4052 else report
0 1 "$w is a reserved keyword" -
4055 *) case $define$w in
4057 1*) echo "#define $v $w /* alternate for reserved keyword $v */" ;;
4083 typedef int (*_IFFE_fun)();
4089 static _IFFE_fun i=(_IFFE_fun)$v;int main(){return ((unsigned int)i)^0xaaaa;}
4093 if compile
$cc -c $tmp.c
<&$nullin >&$nullout
4095 elif compile
$cc $d -c $tmp.c
<&$nullin >&$nullout
4099 if test error
!= "$d"
4101 if compile
$cc $d $static -o $tmp.exe
$tmp.o
$lib $deflib <&$nullin >&$nullout &&
4102 $executable $tmp.exe
4107 report
$c 1 "$v() in default lib(s)" "$v() not in default lib(s)" "default for function $v()"
4110 compile
$cc $d $static -o $tmp.exe
$tmp.o
-lm <&$nullin >&$nullout &&
4111 $executable $tmp.exe
4112 report $?
1 "$v() in math lib" "$v() not in math lib" "default for function $v()"
4114 *) report
1 1 - "$v() not in default lib(s)" "default for function $v()"
4118 else if compile
$cc -D_IFFE_type -c $tmp.c
<&$nullin >&$nullout
4120 else case $intrinsic in
4131 static int ((*i)())=foo;int main(){return(i==0);}
4133 compile
$cc -c $tmp.c
<&$nullin >&$nullout
4140 mth
) report
$c 1 "$v() in math lib" "$v() not in math lib" "default for function $v()" ;;
4141 *) report
$c 1 "$v() in default lib(s)" "$v() not in default lib(s)" "default for function $v()" ;;
4157 compile
$cc -E $tmp.c
<&$nullin |
grep -c "'$m:$v'" >&$nullout
4158 report $?
1 "$v is a macro" "$v is not a macro" "default for macro $v"
4161 ?
*) eval i
='$'_iffe_typedef_
$p
4169 int n = sizeof(i);" > $tmp.c
4171 if compile
$cc -c $tmp.c
<&$nullin >&$nullout
4173 eval _iffe_typedef_
$p=1
4176 eval _iffe_typedef_
$p=0
4182 0) i
="$v is not a member of $p" p
="struct $p" ;;
4191 int n = sizeof(i.$v);" > $tmp.c
4192 compile
$cc -c $tmp.c
<&$nullin >&$nullout
4193 report $?
1 "$v is a member of $p" "$i"
4196 eval i
='$'_iffe_typedef_
$p
4204 int n = sizeof(i);" > $tmp.c
4206 if compile
$cc -c $tmp.c
<&$nullin >&$nullout
4208 eval _iffe_typedef_
$p=1
4211 eval _iffe_typedef_
$p=0
4217 0) i
="$p is not a non-opaque struct" p
="struct $p" ;;
4226 int n = sizeof(i);" > $tmp.c
4227 if compile
$cc -c $tmp.c
<&$nullin >&$nullout
4233 unsigned long f() { return (unsigned long)i; }" > $tmp.c
4234 if compile
$cc -c $tmp.c
<&$nullin >&$nullout
4240 report
$c 1 "$p is a non-opaque struct" "$i"
4253 struct _iffe_struct { int _iffe_member; };
4255 extern struct _iffe_struct* $v(struct _iffe_struct*);
4257 extern struct _iffe_struct* $v();
4261 # some compilers with -O only warn for invalid intrinsic prototypes
4263 *" -O "*) xx
=`echo $cc | sed 's/ -O / /g'` ;;
4266 compile
$xx -c $tmp.c
<&$nullin >&$nullout
4267 report
-$config $?
1 "$v() needs a prototype" "$v() does not need a prototype"
4278 int _iffe_int = $v / 2;
4281 compile
$cc -c $tmp.c
<&$nullin >&$nullout
4282 report $?
1 "$v is a numeric constant" "$v is not a numeric constant"
4284 one
) for i
in $a $hdr
4285 do x
="#include <$i>"
4292 *) echo "$x" > $tmp.c
4294 then gothdr
="$gothdr + $x"
4295 else gothdr
="$gothdr - $x"
4305 *) echo "$one" > $tmp.c
4306 if compile
$cc -E $tmp.c
<&$nullin >$tmp.i
4309 *[\\/]*) c
=`echo $c | sed 's,[\\\\/],[\\\\/],g'` ;;
4311 case `sed -e '/^#[line ]*1[ ][ ]*"[\\\\\/].*[\\\\\/]'$c'"/!d' $tmp.i` in
4323 no-
*) case $shell in
4324 ksh
) m
=_opt_
${m#_opt_no_}
4327 *) eval m
=`echo $m | sed 's/_opt_no_/_opt_/'`
4328 eval a
=`echo $a | sed 's/^no-//'`
4331 case " $PACKAGE_OPTIONS " in
4336 *) case " $PACKAGE_OPTIONS " in
4344 report
$c 1 "$a is set in \$PACKAGE_OPTIONS" "$a is not set in \$PACKAGE_OPTIONS"
4360 b
="fnd()${nl}{${t}for ${x} in"
4362 '}') b
="${b}${t}do${tab}if $exists ${v}/\${1}${t}${tab}${tab}then${tab}f=${v}/\${1}${t}${tab}${tab}${tab}return${t}${tab}${tab}fi"
4370 -) b
="${b}${t}do${tab}test \"${v}\" = '' -o -d \"${v}\" &&${t}${tab}${tab}"
4375 t
="${t}${tab}${tab}"
4378 '') if $exists ${i}/${a}
4385 *) b
="${b} /${i}" ;;
4406 report
$c "$f" "${note:-$a path}" "$a path not found"
4410 then failure not found
4412 0) echo "$command: $file$line: $a: not found" >&$stderr ;;
4420 grep '^#include.*iffe --include-first' $a
4426 grep -v '^#include.*iffe --include-first' $a
4428 compile
$cc -o $tmp.exe
$tmp.c
$lib $deflib <&$nullin >&$stderr 2>&$stderr &&
4429 $executable $tmp.exe
&&
4430 execute
$tmp.exe
$opt <&$nullin
4434 set \"cc='$cc' executable='$executable' id='$m' static='$static' tmp='$tmp'\" $opt $hdr $test"
4438 ( .
$tmp.sh
) <&$nullin
4446 *) failure cannot run
4448 0) echo "$command: $file$line: $a: cannot run" >&$stderr ;;
4461 long
:*|
*:*[_0123456789
]int
[_0123456789
]*)
4468 $x$v v; i = 1; v = i;"
4469 echo "i = v * i; i = i / v; v = v + i; i = i - v;"
4472 *) echo "v <<= 4; i = v >> 2; i = 10; i = v % i; i |= v; v ^= i; i = 123; v &= i;" ;;
4478 struct xxx { $x$v mem; };
4479 static struct xxx v;
4480 struct xxx* f() { return &v; }"
4484 ""|
"struct "|
"union ")
4485 echo "int g() { return 0; }"
4487 *) echo "int g() { return sizeof($x$v)<=sizeof($v); }" ;;
4493 printf(\"%u\\n\", sizeof($x$v));
4497 rm -f $tmp.exe
$tmp.dat
4498 if compile
$cc -o $tmp.exe
$tmp.c
$lib $deflib <&$nullin >&$nullout &&
4499 $executable $tmp.exe
&&
4500 execute
$tmp.exe
> $tmp.dat
4501 then z
=`cat $tmp.dat`
4506 report
$c "$z" "sizeof($x$v)" "$x$v not a type with known size"
4516 '=' $x '='" > $tmp.c
4517 compile
$cc -E $tmp.c
<&$nullin \
4522 -e 's/((([^()]*)))->/->/g' \
4523 -e 's/(([^()]*))->/->/g' \
4524 -e 's/([^()]*)->/->/g' \
4525 -e 's/\([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*\)\[/\
4527 -e 's/\([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*\)(/\
4529 -e 's/\*->\([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]\)/->\
4531 -e 's/->\([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]\)/->\
4534 -e 's/^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*$/\
4541 -e 's/\(...\) \([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*\).*/#ifndef _\1_'$v'\
4542 #define _\1_'$v' \2\
4543 #define _\1_'$v'_str "\2"\
4553 long
:*|
*:*[_0123456789
]int
[_0123456789
]*)
4560 $x$v v; i = 1; v = i;"
4561 echo "i = v * i; i = i / v; v = v + i; i = i - v;"
4564 *) echo "v <<= 4; i = v >> 2; i = 10; i = v % i; i |= v; v ^= i; i = 123; v &= i;" ;;
4572 struct xxx { $x$v$r mem; };
4573 static struct xxx v;
4574 struct xxx* f() { return &v; }"
4578 ""|
"struct "|
"union ")
4579 echo "int main() { f(); return 0; }" ;;
4580 *) echo "int main() { f(); return sizeof($x$v)<=sizeof($v); }" ;;
4584 compile
$cc -o $tmp.exe
$tmp.c
$lib $deflib <&$nullin >&$nullout &&
4585 $executable $tmp.exe
&&
4587 report $?
1 "$x$v is a type" "$x$v is not a type" "default for type $x$v"
4590 '"'*'"')echo $arg=\'$val\' ;;
4591 *) echo $arg=\"$val\" ;;
4601 *) echo "$command: $file$line: $o: unknown feature test" >&$stderr
4609 FAILURE
) result
=SUCCESS
;;
4610 *) result
=FAILURE
;;
4615 FAILURE
) user_pf
=$fail user_yn
=$no ;;
4616 *) user_pf
=$pass user_yn
=$yes ;;
4619 ?
*) eval "$user_pf" <&$nullin ;;
4625 ?
*) case $user_yn in
4626 *$nl*) user_yn
="/* $note */$nl$user_yn" ;;
4627 *) user_yn
="$user_yn /* $note */" ;;
4636 case $ifelse:$result in
4637 TEST
:SUCCESS
) ifelse
=KEEP
;;
4638 TEST
:*) ifelse
=SKIP
;;
4640 case $group:$result in
4641 :*|
*:SUCCESS
) break ;;
4643 set '' $groups '' "$@"
4650 # set up and try the next group
4666 *[\"\'\
(\
)\
{\
}\ \
]*)
4672 *) test="$test $1" ;;
4681 -*) groups
="$groups $1" ;;
4686 bsh
) x
=`echo X$1 | sed 's/X+/-/'` ;;
4687 *) eval 'x=-${1#+}' ;;
4690 -*) groups
="$groups $x" ;;
4694 -*|
+*) case $group in
4695 -*) groups
="$groups $1"
4701 -D*) mac
="$mac $1" ;;
4709 *.
[aAxX
]|
*.
[dD
][lL
][lL
]|
*.
[lL
][iI
][bB
])
4711 -*) groups
="$groups $1" ;;
4717 -*) groups
="$groups $1"
4720 pth
) pth
="$pth $1" ;;
4727 -*) groups
="$groups $1"
4734 *) test="$test $1" ;;