########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1994-2012 AT&T Intellectual Property #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# Glenn Fowler <gsf@research.att.com> #
# #
########################################################################
# Glenn Fowler & Phong Vo
# AT&T Research
#
# test if feature exists
# this script is written to make it through all sh variants
#
case $-:$BASH_VERSION in
esac
command=iffe
{
case $_compile_status in
[1-9]|[1-9][0-9]|1[01][0-9]|12[0-7])
then _compile_status=139
fi
;;
esac
fi
case $_compile_status in
?|??|1[01]?|12[0-8]|25?)
;;
exit $_compile_status
;;
esac
return $_compile_status
}
{
case $1 in
-) _is_hdr_flag=-; shift ;;
*) _is_hdr_flag= ;;
esac
case $1 in
*.c) _is_hdr_file=$1; shift ;;
*) _is_hdr_file=$tmp.c ;;
esac
case $_is_hdr_status in
0) if test -s $tmp.e
?*) _is_hdr_status=1 ;;
esac
fi
;;
esac
case $_is_hdr_status in
;;
esac
;;
esac
return $_is_hdr_status
}
{
case $1 in
esac
return
;;
'<') shift
;;
*) return
;;
esac
case $1 in
X|X11*) i="openwin"
case $1 in
X) set X11 ;;
esac
case $1 in
1) set $1 6 5 4 ;;
esac
;;
esac
;;
*) i=
;;
esac
pth="{ usr . - . contrib local $i - . share - . lib - $1"
i=$1
while :
do shift
case $# in
0) break ;;
esac
case $1 in
'>') shift; break ;;
esac
done
}
{
1) failure ;;
esac
oo=$1
shift
case $1 in
ii=$1
complete=1
esac
;;
esac
esac
complete=1
;;
esac
;;
esac
}
{
case $1 in
-) shift
;;
esac
case $1 in
+) return ;;
esac
;;
esac
1:1) case $suspended in
1) suspended=0
;;
esac
complete=0
case $# in
esac
esac
;;
esac
}
{
case $1 in
-) shift ;;
case $1 in
+) return ;;
esac
;;
esac
1:1) case $suspended in
1) suspended=0
;;
esac
complete=0
*) mm=$* ;;
esac
;;
*) mm=
;;
esac
esac
;;
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
{
case $1 in
-) _report_ignore=$1
shift
;;
*) _report_ignore=
;;
esac
case $1 in
-0) shift
;;
-1) shift
1) _report_not= ;;
*) _report_not=1 ;;
esac
;;
esac
;;
esac
-:*) ;;
*:0) success $_report_ignore
;;
?*) return ;;
esac
;;
esac
case $_report_not in
1) case $_report_status in
0) _report_status=1 ;;
*) _report_status=0 ;;
esac
;;
*) _report_success=$3
;;
esac
case $_report_status in
0) case $M in
*-*) ;;
*) usr="$usr$nl#define $m $_report_value"
case $_report_success in
''|-) ;;
n) echo "$m=$_report_value"
esac
;;
esac
eval $m=\'$_report_value\'
;;
esac
;;
*) case $M in
*-*) ;;
*) case $_report_failure in
''|-) ;;
esac
;;
esac
case $_report_default in
''|-) ;;
esac
;;
esac
eval $m=0
;;
esac
;;
esac
}
{
1:1) suspended=1
echo >&$stderr
;;
esac
}
{
if cat <<!
$*
!
else case $here_broken in
0) here_broken=1
;;
esac
sh -c "cat <<!
$*
!
"
fi
}
{
case $1 in
ksh) print -r - "$2"
;;
*) if cat <<!
$2
!
else case $here_broken in
0) here_broken=1
;;
esac
sh -c "cat <<!
$2
!
"
fi
;;
esac
;;
;;
$2
!
else case $here_broken in
0) here_broken=1
;;
esac
sh -c "cat > \"$1\" <<!
$2
!
"
fi
;;
esac
;;
esac
}
# verify that cc is a C compiler
{
# check for local package root directories
case $PACKAGE_PATH in
fi
eval export $y
done
fi
done
;;
esac
then cctest="should not compile '(;'"
fi
else cctest="should compile 'int i = 1;'"
fi
;;
exit 1
;;
esac
}
{
esac
case $posix_read in
-no) ;;
a z
!
`
;;
esac
case $posix_read in
;;
extern int read();
extern int write();
int main()
{
char c;
char r;
int k;
char s[32];
k = 0;
while (read(0, &c, 1) == 1)
{
if (k >= 0)
{
if (c == ' ' || c == '\\t')
{
if (k < sizeof(s))
s[k++] = c;
continue;
}
if (k > 1 && c != '#' && c != '\\n' && c != '\\r')
write(1, s + 1, k - 1);
k = -1;
}
if (c == '\\r')
{
r = c;
if (read(0, &c, 1) == 1 && c != '\\n')
write(1, &r, 1);
}
write(1, &c, 1);
if (c == '\\n')
return 0;
}
return 1;
}"
then posix_read=${tmp}r.exe
exit 1
fi
;;
esac
}
{
esac
_execute_=$?
elif test -d /NextDeveloper
_execute_=$?
_execute_=$?
fi
return $_execute_
}
{
'') return 0 ;;
esac
for _exclude_var
do eval _exclude_old=\$$_exclude_var
case $_exclude_old in
*" -I"*);;
*) continue ;;
esac
do _exclude_skip=
for _exclude_dir in $excludes
do case $_exclude_arg in
-I$_exclude_dir|-I*/$_exclude_dir)
break;
;;
esac
done
case $_exclude_skip in
_exclude_sep=" "
;;
esac
done
eval $_exclude_var=\$_exclude_new
0) ;;
;;
esac
done
}
all=0
apis=
binding="-dy -dn -Bdynamic -Bstatic -Wl,-ashared -Wl,-aarchive -call_shared -non_shared '' -static"
complete=0
config=0
define=1
explicit=0
iff=
usr=
debug=0
executable="test -x"
exists="test -e"
idno=
'}
in=
libpaths="LD_LIBRARY_PATH LD_LIBRARYN32_PATH LD_LIBRARY64_PATH LIBPATH SHLIB_PATH"
nl="
"
optimize=1
one=
out=
esac
;;
esac
;;
*) case $BASH_VERSION in
esac
;;
esac
static=.
""|?|??|???|????|????)
;;
*) eval 'tmp=${HOSTNAME%${HOSTNAME#????}}' ;;
esac
;;
esac
;;
;;
esac
export COTEMP
./*) ;;
??????????*)
*) eval 'tmp=${tmp%${tmp#?????????}}' ;;
esac
;;
?????????)
;;
????????)
;;
esac
./*) ;;
esac
undef=0
verbose=0
vers=
# options -- `-' for output to stdout otherwise usage
case $1 in
-) out=-; shift ;;
esac
set=
[-?
@(#)$Id: iffe (AT&T Research) 2012-07-17 $
]
[+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
the behavior of the C compiler and generated programs.]
[+?\biffe\b statements are line oriented. Statements may appear in the
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 \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
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
to the standard output and no update checks are done.]
\biffe\b statements.]
[a:all?Define failed test macros \b0\b. By default only successful test macros
are defined \b1\b.]
[c:cc?Sets the C compiler name and flags to be used in the feature
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 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 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 and does
not remove core dumps on exit.]#[level]
[D:define?Successful test macro definitions are emitted. This is the default.]
[E:explicit?Disable implicit test output.]
[F:features?Sets the feature test header to \ahdr\a. This header typically
defines *_SOURCE feature test macros.]:[hdr:=NONE]
[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]
[L:library?Adds \b-L\b\adir\a to the C compiler flags.]:[dir]
[n:name-value?Output \aname\a=\avalue\a assignments only.]
[N!:optimize?\b--nooptimize\b disables compiler optimization options.]
[o:output?Sets the output file name to \afile\a.]:[file]
[O:stdio?Sets the standard io header to \ahdr\a.]:[hdr:=stdio.h]
[e:package?Sets the \bproto\b(1) package name to \aname\a.]:[name]
[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]
[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). The supported names are \bksh\b, \bbsh\b, \bbash\b, and
\bosh\b. \bosh\b forces the \bread -r\b compatibility read command to
be compiled and used instead of \bread -r\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
library symbols are only detected when referenced at runtime from
dynamically linked executables.]:[flags]
[u:undef?\b#undef\b failed test macros. By default only successful test macros
are defined \b1\b.]
[v:verbose?Produce a message line on the standard error for each test as
it is performed.]
[x:cross?Some tests compile an executable (\ba.out\b) and then run it.
If the C compiler is a cross compiler and the executable format is
incompatible with the execution environment then the generated
executables must be run in a different environment, possibly on
another host. \acrosstype\a is the HOSTTYPE for generated executables
(the \bpackage\b(1) command generates a consistent HOSTTYPE namespace).
Generated executables are run via \bcrossexec\b(1) with \acrosstype\a
as the first argument. \bcrossexec\b supports remote execution for
cross-compiled executables. See \bcrossexec\b(1) for
details.]:[crosstype]
[X:exclude?Removes \b-I\b\adir\a and \b-I\b*/\adir\a C compiler flags.]:[dir]
[ - ] [ file.iffe | statement [ : statement ... ] ]
[+SYNTAX?\biffe\b input consists of a sequence of statement lines. Statements
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 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.]
[+library references?\b-l\b*, *\b.a\b, etc. \b_LIB_\b\aname\a
is defined to be 1 if \b-l\b\aname\a is a library.]
[+header references?*\b.h\b. \a_dir_name\a is defined to be 1
omitted, \b_hdr_\b\aname\a is defined to be 1 if
\aname\a\b.h\b is a header.]
[+-?Prereq grouping mark; prereqs before the first \b-\b are
passed to all feature tests. Subsequent groups
are attempted in left-to-right order until the first
successful group is found.]
}
[+?\abegin\a\b{\b ... \b}end\b delimit multiline code blocks that override
or augment the default code provided by \biffe\b. User supplied code
blocks should be compatible with the K&R, ANSI, and C++ C language
dialects for maximal portability. Test code may call the function
\bNOTE("...")\b to emit short text in \b--verbose\b output; only one
\bNOTE()\b should be called per test for readability. In addition to
all macro definitions generated by previous tests, all generated
code contains the following at the top to hide dialect differences:]{
[+ ?#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)]
[+ ?#define _STD_ 1]
[+ ?#define _ARG_(x) x]
[+ ?#define _VOID_ void]
[+ ?#else]
[+ ?#define _STD_ 0]
[+ ?#define _ARG_(x) ()]
[+ ?#define _VOID_ char]
[+ ?#endif]
[+ ?#if defined(__cplusplus)]
[+ ?#define _BEGIN_EXTERNS_ extern "C" {]
[+ ?#define _END_EXTERNS_ }]
[+ ?#else]
[+ ?#define _BEGIN_EXTERNS_]
[+ ?#define _END_EXTERNS_]
[+ ?#endif]
[+ ?#define _NIL_(x) ((x)0)]
[+ ?#include <stdio.h>]
}
[+?= \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
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 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
is written to the standard output.]
[+--output=\afile\a?Output is \afile\a.]
[+set out \afile\a?Output is \afile\a.]
[+[run]] [\adirectory\a/]]\abase\a[\a.suffix\a]]?Output is
\bFEATURE/\b\abase\a.]
}
[+?Generated \biffe\b headers are often referenced in C source as:
\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#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-ignorant file systems
happy.]
[+?The feature tests are:]{
[+# \acomment\a?Comment line - ignored.]
[+api \aname\a \aYYYYMMDD\a \asymbol ...\a?Emit api compatibility tests
for \aname\a and \b#define\b \asymbol\a \asymbol\a_\aYYYYMMDD\a
when \aNAME\a_API is >= \aYYYYMMDD\a (\aNAME\a is \aname\a
converted to upper case). If \aNAME\a_API is not defined
then \asymbol\a maps to the newest \aYYYYMMDD\a for \aname\a.]
[+define \aname\a [ (\aarg,...\a) ]] [ \avalue\a ]]?Emit a macro
\b#define\b for \aname\a if it is not already defined. The
definition is passed to subsequent tests.]
[+extern \aname\a \atype\a [ (\aarg,...\a) | [\adimension\a]] ]]?Emit
an \bextern\b prototype for \aname\a if one is not already
defined. The prototype is passed to subsequent tests.]
[+header \aheader\a?Emit \b#include <\b\aheader\a\b>\b if \aheader\a
exists. The \b#include\b is passed to subsequent tests.]
[+print \atext\a?Copy \atext\a to the output file. \atext\a is passed
to subsequent tests.]
[+reference \aheader\a?If \aheader\a exists then add \b#include\b
\aheader\a to subsequent tests.]
[+ver \aname\a \aYYYYMMDD\a?\b#define\b \aNAME\a_VERSION \aYYYYMMDD\a
(\aNAME\a is \aname\a converted to upper case).]
[+cmd \aname\a?Defines \b_cmd_\b\aname\a if \aname\a is an executable
\b_\b\adirectory\a\b_\b\aname\a is defined for \adirectory\a
in which \aname\a is found (with \b/\b translated to \b_\b).]
[+dat \aname\a?Defines \b_dat_\b\aname\a if \aname\a is a data symbol
in the default libraries.]
[+def \aname\a?Equivalent to \bcmd,dat,hdr,key,lib,mth,sys,typ\b
\aname\a.]
[+dfn \aname\a?If \aname\a is a macro in the candidate headers then
a \b#define\b \aname\a \avalue\a statment is output for the
\avalue\a defined in the headers. The definition is \b#ifndef\b
guarded.]
[+exp \aname\a \aexpression\a?If \aexpression\a is a \"...\" string
then \aname\a is defined to be the string, else if the
\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 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. 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.]
[+inc \afile\a [ re ]]?Read #define macro names from \afile\a
and arrange for those names to evaluate to 1 in \bexp\b
expressions. If \are\a is specified then macros not matching
\are\a are ignored.]
[+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 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. The default \are\a is \b^HAVE_\b
for \b--config\b and \b^_\b otherwise.]
[+lib \aname\a?Defines \b_lib_\b\aname\a if \aname\a is an external
symbol in the default libraries.]
[+mac \aname\a?Defines \b_mac_\b\aname\a if \aname\a is a macro.]
[+mem \astruct.member\a?Defines \b_mem_\b\amember\a\b_\b\astruct\a
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 test then \aname\a may be used
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
\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 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.]
[+opt \aname\a?Defines \b_opt_\b\aname\a if \aname\a is a space-separated
token in the global environment variable \bPACKAGE_OPTIONS\b.]
[+pth \afile\a [ \adir\a ... | { \ag1\a - ... - \agn\a } | < \apkg\a [\aver\a ...]] > ]]?Defines
\b_pth_\b\afile\a, with embedded \b/\b chars translated to
\b_\b, to the path of the first instance of \afile\a in the
\adir\a directories. \b{\b ... \b}\b forms a directory list
from the cross-product of \b-\b separated directory groups
\ag1\a ... \agn\a. < ... > forms a directory list for the
package \apkg\a with optional versions. If no operands are
specified then the default PATH directories are used. The
\b--config\b macro name is \aNAME\a\b_PATH\b.]
[+run \afile\a?Runs the tests in \afile\a based on the \afile\a
suffix:]{
[+.c?\afile\a is compiled and executed and the output is copied
to the \biffe\b output file. Macros and headers supplied
to \bbegin{\b ... \b}end\b are also supplied to
\afile\a.]
[+.sh?\afile\a is executed as a shell script and the output is
copied to the \biffe\b output file.]
[+.iffe \bor no suffix?\afile\a contains \biffe\b
statements.]
}
[+set \aoption value\a?Sets option values. The options are described
above.]
[+siz \aname\a?Defines \b_siz_\b\aname\a to be \bsizeof\b(\aname\a) if
translated to space before testing and are translated to \b_\b
in the output macro name.]
[+sym \aname\a?Defines \b_ary_\b\aname\a if \aname\a is an array,
\b_fun_\b\aname\a if \aname\a is a function pointer,
\b_ptr_\b\aname\a if \aname\a is a pointer, or
\b_reg_\b\aname\a if \aname\a is a scalar. In most cases
\aname\a is part of a macro expansion.]
[+sys \aname\a?Defines \b_sys_\b\aname\a if the header
\b<sys/\b\aname\a\b.h>\b exists. The \b--config\b macro name is
\bHAVE_SYS_\b\aNAME\a\b_H\b.]
[+tst \aname\a?A user defined test on name. A source block must be
supplied. Defines \b_\b\aname\a on success. \btst - ...\b is
treated as \btst - - ...\b.]
[+typ \aname\a?Defines \b_typ_\b\aname\a if \aname\a is a type in any
\b.\b characters in \aname\a are translated to space before
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 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. 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 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.]
[+status?The block is compiled, linked, and executed, and the exit
status is the test outcome, 0 for \afailure\a, the value
otherwise.]
[+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?\bautoconf\b(1), \bconfig\b(1), \bgetconf\b(1), \bcrossexec\b(1),
\bnmake\b(1), \bpackage\b(1), \bproto\b(1), \bsh\b(1)]
'
a) set="$set set all :" ;;
C) set="$set set config :" ;;
D) set="$set set define :" ;;
E) set="$set set explicit :" ;;
p) set="$set set prototyped :" ;;
r) set="$set set regress :" ;;
u) set="$set set undef :" ;;
v) set="$set set verbose :" ;;
esac
done
;;
*) while :
do case $# in
0) break ;;
esac
case $1 in
-) break
;;
--) shift
break
;;
REM=a
;;
;;
REM=C
;;
;;
;;
REM=D
;;
;;
REM=E
;;
;;
;;
;;
;;
REM=n
;;
;;
;;
REM=p
;;
;;
REM=r
;;
;;
;;
;;
REM=u
;;
REM=v
;;
exit 2
;;
;;
*) break
;;
esac
shift
while :
'') break ;;
esac
'') case $# in
exit 1
;;
esac
OPTARG=$1
shift
;;
REM=''
;;
esac
esac
a) set="$set set all :" ;;
C) set="$set set config :" ;;
D) set="$set set define :" ;;
E) set="$set set explicit :" ;;
p) set="$set set prototyped :" ;;
r) set="$set set regress :" ;;
u) set="$set set undef :" ;;
v) set="$set set verbose :" ;;
*) echo "Usage: $command [-aCDEnpruv] [-c C-compiler-name [C-compiler-flags ...]] [-d level]
[-F features-header] [-i file] [-o file] [-O stdio-header] [-e name] [-P text]
[-s shell-path] [-S[flags]] [-x cross-exec-prefix] [-I dir] [-L dir] [-X dir] [ - ]
[ file.iffe | statement [ : statement ... ] ]" >&2
exit 2
;;
esac
done
done
;;
esac
case $1 in
-) out=-; shift ;;
esac
case $# in
0) in=- ;;
esac
set -- $set "$@"
case " $* " in
*' set config '*|*' run config.'*|*' run '*' config.'*|*' run '*'/config.'*)
config=1
;;
esac
# standard output to the current output file
#
# stdout original standard output
# stderr original standard error
case " $* " in
*" set debug "[3456789]*)
;;
*) eval "exec 2>&$nullout"
;;
esac
# prompt complications
esac
;;
esac
# tmp files cleaned up on exit
# status: 0:success 1:failure 2:interrupt
status=1
2) core=
;;
then ulimit -c 0
core=
else core="core core.??*"
fi
;;
esac
else echo "$command: cannot create tmp files in current dir" >&2
exit 1
fi
status=2
# standard header for c source
std='#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
#define _STD_ 1
#define _ARG_(x) x
#define _VOID_ void
#else
#define _STD_ 0
#define _ARG_(x) ()
#define _VOID_ char
#endif
#if defined(__cplusplus)
#define _BEGIN_EXTERNS_ extern "C" {
#define _END_EXTERNS_ }
#else
#define _BEGIN_EXTERNS_
#define _END_EXTERNS_
#endif
#define _NIL_(x) ((x)0)'
tst=
# loop on op [ arg [ ... ] ] [ : op [ arg [ ... ] ] ]
argx=0
cur=.
can=
file=
ini=
init=1
line=0
nan=
while :
1:$argv);;
set x $argv
shift
;;
esac
;;
'') if read lin
esac
set x $lin
case $# in
1) continue ;;
esac
else set x
fi
;;
set x $ini
ini=
;;
esac
shift
;;
print|ref|set)
;;
*) init=0
ini=$*
set ini
;;
esac
esac
;;
esac
case $# in
exit 1
;;
esac
set set out +
;;
esac
# if nesting
while :
do case $1 in
;;
TEST) ;;
;;
esac
shift
1) set '' - "$@"; shift ;;
esac
;;
;;
TEST) ;;
;;
exit 1
;;
esac
shift
1) set '' - "$@"; shift ;;
esac
;;
;;
;;
exit 1
;;
esac
shift
;;
exit 1
;;
esac
;;
;;
esac
shift
;;
*) break
;;
esac
done
# check if "run xxx" is equivalent to "set in xxx"
case $1 in
esac
case $1 in
:) shift
continue
;;
*) x=$2 ;;
esac
;;
*) eval 'x=${2##*[\\/]}'
;;
esac
case $x in
set set in $2 ;;
*.*) ;;
*) set set in $2 ;;
esac
;;
esac
# { inc set } drop out early
case $1 in
""|"#"*)continue
;;
esac
shift
case $# in
exit 1
;;
esac
p=$1
shift
if test ! -f $p
exit 1
fi
case $# in
1) e="^HAVE_" ;;
*) e="^_" ;;
esac
;;
1) e=$1
;;
*) shift
;;
esac
eval `sed -e '/^#define[ ]/!d' -e 's/#define[ ]//' -e 's/[ (].*//' ${e:+"-e/$e/!d"} -e 's/.*/&=1/' $p | LC_ALL=C sort -u`
continue
;;
esac
shift
case $1 in
;;
*) arg=
op=$1
esac
;;
;;
;;
esac
;;
esac
N) op=nooptimize ;;
p) op=prototyped ;;
esac
;;
esac
shift
while :
do case $# in
0) break ;;
esac
case $1 in
*" "*) shift
continue
;;
""|"#"*)break
;;
:) shift
break
;;
esac
esac
shift
done
;;
esac
continue
;;
"") case $x in
bsh) eval $x
;;
*) export $x
;;
esac
;;
1) occ=$x ;;
esac
;;
*) occ=$x
;;
esac
;;
;;
esac
done
continue
;;
continue
;;
""|-) cross= ;;
esac
continue
;;
set -
show=echo
SHOW=
;;
set -
show=echo
SHOW=
;;
ksh) eval 'PS4="${PS4%+*([ ])}+\$LINENO+ "'
esac
show=echo
SHOW=
set -x
;;
;;
esac
continue
;;
continue
;;
""|-) excludes= ;;
esac
continue
;;
explicit=1
continue
;;
'') tst= ;;
esac
continue
;;
"in"|input)
"") in=-
;;
if test ! -r $in
exit 1
fi
exec < $in
*[.\\/]*)
;;
*) eval 'out=${in##*[\\/]}'
eval 'out=${out%.*}'
;;
esac
;;
;;
esac
;;
esac
;;
esac
continue
;;
""|-) includes= ;;
esac
continue
;;
eval export $y
done
continue
;;
continue
;;
set -
continue
;;
define=0
continue
;;
optimize=0
;;
esac
;;
optimize=1
;;
usr=
one=
output) continue ;;
esac
def=
test=
;;
continue
;;
*) prototyped= ;;
esac
continue
;;
continue
;;
continue
;;
;;
esac
continue
;;
continue
;;
'') ext=
;;
*) ext=
sep=
do case $i in
'') continue ;;
*) break ;;
esac
;;
esac
echo "#include \"$i\"" > t.c
fi
done
;;
esac
continue
;;
continue
;;
continue
;;
exit 1
;;
esac
;;
op=$1
shift
arg=
;;
*) case $2 in
shift
shift
;;
*) case $1 in
shift
;;
*) def=
;;
esac
;;
esac
case $1 in
shift
;;
*) not=
;;
esac
case $1 in
*'{') op=-
;;
'('*|'"'*'"'|'<'*'>')
'') def=- ;;
esac
;;
*) op=$1
shift
;;
esac
arg=
fail=
hdr=
lib=
mac=
no=
note=
opt=
pass=
pth=
run=
set=
src=
test=
yes=
case $# in
0) ;;
*) case $1 in
"#"*) set x
shift
;;
ref) ;;
*) case $1 in
case $2 in
-) shift ;;
esac
;;
*:-*) arg=$1
shift
;;
*) def=-
shift
case $1 in
'('*|*'{'|'"'*'"'|'<'*'>')
arg=-
;;
*) arg=$1
case $# in
0) ;;
*) shift ;;
esac
;;
esac
;;
esac
;;
-*|+*|'('*|*'{'|'"'*'"'|'<'*'>')
arg=-
;;
*) arg=$1
shift
;;
esac
;;
esac
;;
esac
case $1 in
'('*|'"'*'"'|'<'*'>')
while :
do case $# in
0) break ;;
esac
case $1 in
*[.{}]*)break ;;
esac
'') test=$1 ;;
*) test="$test $1" ;;
esac
shift
done
'') arg=- ;;
esac
''|'-') ;;
esac
;;
esac
;;
esac
while :
do case $# in
0) break ;;
esac
case $1 in
"") ;;
"#"*) set x
;;
"=") shift
set=$*
"") set=" " ;;
esac
while :
do case $# in
0) break ;;
esac
shift
done
break
;;
v=$1
shift
x=
case $v in
"note{")
sep=" " ;;
esac
case $v in
'{') e='}' ;;
*) e='}end' ;;
esac
n=1
SEP=
while :
do case $# in
-*) checkread ;;
esac
exit 1
;;
esac
while :
do case $posix_read in
eof=$?
while :
do lin="${lin#[' ']}"
[' ']*'#'*);;
*) break ;;
esac
done
;;
*) IFS=
read -r lin
eof=$?
!
`
;;
esac
;;
esac
;;
*) lin=`$posix_read`
eof=$?
;;
esac
esac
set x $lin
case $2 in
ksh) let n=n+1 ;;
*) n=`expr $n + 1` ;;
esac
;;
$e|$e';')
case $n in
1) shift
break 2
;;
esac
ksh) let n=n-1 ;;
*) n=`expr $n - 1` ;;
esac
;;
esac
;;
exit 1
;;
esac
done
;;
esac
case $1 in
ksh) let n=n+1 ;;
*) n=`expr $n + 1` ;;
esac
;;
$e|$e';')
case $n in
1) break ;;
esac
ksh) let n=n-1 ;;
*) n=`expr $n - 1` ;;
esac
;;
esac
x="$x$SEP$1"
shift
done
case $v in
'note{');;
*) x="$x$nl" # \r\n bash needs this barf # ;;
esac
case $v in
'fail{') fail=$x ;;
'no{') no=$x ;;
'note{') note=$x ;;
'pass{') pass=$x ;;
'test{') test=$x ;;
esac
;;
:) shift
break
;;
*[\"\'\(\)\{\}\ \ ]*)
;;
'') test=$1 ;;
*) test="$test $1" ;;
esac
;;
esac
;;
;;
;;
esac
;;
esac
;;
*) eval 'x=-${1#+}' ;;
esac
esac
;;
case $1 in
esac
do eval $y=\"\$$y:\$x\$${y}_default\"
eval export $y
done
;;
esac
;;
;;
;;
*) case $1 in
esac
;;
esac
;;
esac
;;
esac
;;
esac
;;
*[.\\/]*)
;;
esac
;;
esac
;;
;;
;;
'') test=$1 ;;
*) test="$test $1" ;;
esac
;;
esac
;;
esac
;;
esac
shift
done
-) group= ;;
esac
;;
esac
;;
esac
esac
# make sure $cc compiles C
esac
"") checkcc ;;
esac
# some ops allow no args
a=$1
shift
*" $a "*)
;;
;;
esac
rel=
while :
do case $# in
0) break ;;
esac
case $1 in
[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])
;;
*) break
;;
esac
shift
done
while :
do case $# in
0) break ;;
esac
case $1 in
:) break ;;
esac
esac
done
shift
done
;;
;;
esac
while :
do case $# in
0) break ;;
esac
case $1 in
:) break ;;
esac
shift
done
;;
;;
continue
;;
define) x=$1
shift
case $1 in
'('*')')
arg=$1
shift
;;
esac
"") v=
while :
do case $# in
0) break ;;
esac
t=$1
shift
case $t in
":") break ;;
esac
v="$v $t"
done
;;
*) v=$*
;;
esac
#ifndef $x
(
#endif
int x;
"
then success -
else failure -
fi
continue
;;
extern) x=$1
shift
t=$1
shift
_BEGIN_EXTERNS_
struct _iffe_struct { int _iffe_member; };
extern struct _iffe_struct* $x _ARG_((struct _iffe_struct*));
_END_EXTERNS_
"
# some compilers with -O only warn for invalid intrinsic prototypes
esac
then success -
while :
do case $1 in
''|'('*|'['*)
break
;;
esac
t="$t $1"
shift
done
"") v=
while :
do case $# in
0) break ;;
esac
t=$1
shift
case $t in
":") break ;;
esac
v="$v $t"
done
;;
*) v=$*
;;
esac
copy - "extern $t $x$v;"
# NOTE: technically if prototyped is on all tests should
# be run through proto(1), but we'd like iffe to
# work sans proto -- so we drop the extern's in
# the test headers
case $prototyped in
esac
else failure -
"") while :
do case $# in
0) break ;;
esac
case $1 in
":") break ;;
esac
done
;;
esac
fi
continue
;;
while :
do case $# in
0) break ;;
esac
x=$1
shift
case $x in
":") break ;;
esac
*" - $x "*)
;;
*" + $x "*)
*"# include <"$x">"*)
;;
;;
*) copy - "#include <$x>"
;;
esac
;;
esac
;;
#include <$x>
int x;
"
if is_hdr - $x
;;
*) copy - "#include <$x>"
;;
esac
fi
;;
esac
done
continue
;;
"") v=
while :
do case $# in
0) break ;;
esac
t=$1
shift
case $t in
":") break ;;
esac
v="$v $t"
done
;;
*) v=$*
;;
esac
copy - "$*"
continue
;;
;;
;;
esac
while :
do case $# in
0) break ;;
esac
case $1 in
:) break ;;
esac
shift
done
;;
esac
;;
esac
# NOTE() support
*"<stdio.h>"*)
*"#define NOTE("*)
;;
#define NOTE(s) do{write(9,\" \",1);write(9,s,strlen(s));write(9,\" ...\",4);}while(0)"
;;
esac
;;
esac
# save $* for ancient shells
argx=1
argv=$*
# loop on all candidate groups
while :
do
# check the candidate macros
# check for global default headers (some cc -E insist on compiling)
0) c=_sys_${x}
;;
ksh) typeset -u u=$x ;;
*) u=`echo $x | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
esac
;;
esac
echo "${allinc}#include <$x>" > $tmp.c
if is_hdr $x
;;
esac
eval $c=1
0?1?|0??1)
;;
;;
esac
fi
done
;;
esac
;;
;;
esac
# check the candidate headers
?*) z=$hdr
hdr=
dis=0
for x in $z
do case $x in
*" - $x "*)
continue
;;
*" + $x "*)
;;
bsh) eval `echo $x | sed -e 's,^\\([^\\\\/]*\\).*[\\\\/]\\([^\\\\/]*\\)\$,\\1_\\2,' -e 's/\\..*//' -e 's/^/c=/'`
;;
*) eval 'c=${x##*[\\/]}'
eval 'c=${c%%.*}'
case $x in
*/*) eval 'c=${x%%[\\/]*}_${c}' ;;
esac
;;
esac
;;
*) case $x in
*/*) dis=$c ;;
esac
*) dis=1 ;;
esac
;;
esac
0) case $x in
*/*) c=_${c} ;;
*) c=_hdr_${c} ;;
esac
;;
ksh) typeset -u u=$c ;;
*) u=`echo $c | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
esac
;;
esac
echo "${allinc}#include <$x>" > $tmp.c
if is_hdr $x
;;
esac
eval $c=1
0?1?|0??1)
;;
;;
esac
continue
fi
;;
esac
;;
*) test -r $x || continue
;;
esac
done
;;
esac
# check the candidate libraries
?*) z=
do z="$p $z"
done
lib=
p=
hit=0
echo "int main(){return(0);}" > $tmp.c
for x in $z
do p=$x
*"- $p "*)
failure +
p=
;;
*"+ $p "*)
success +
;;
then success
e=0
else a=
e=1
for l in $z
do case $l in
-) a=
continue
;;
$p) a=$p
continue
;;
*" $l "*) continue ;;
esac
;;
esac
case $a in
$p) a="$a $l"
then success
e=0
break
fi
;;
esac
done
case $e in
1) failure
;;
esac
fi
y=
for x in $p
*) eval 'c=${x#-l}' ;;
esac
case $c in
c=`echo '' $c | sed -e 's,.*[\\\\/],,' -e 's,\.[^.]*$,,' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g' -e '/^lib./s,^lib,,'`
;;
esac
0) case $e$p in
*[-+]" $x "*)
;;
eval _LIB_$c=1
;;
esac
;;
esac
;;
ksh) typeset -u u=$c ;;
*) u=`echo $c | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
esac
c=$u
case $e in
*[-+]" $x "*)
;;
;;
esac
;;
esac
;;
esac
y=${y}_$c
done
0) c=_LIB${y} ;;
esac
case $p in
*' '*) q="a library group" ;;
*) q="a library" ;;
esac
case $e in
eval $c=1
1) break ;;
esac
;;
;;
;;
esac
eval $c=0
;;
esac
p=
;;
esac
done
;;
esac
# last op precheck
break
;;
esac
IFS=" ,"
;;
;;
esac
# check for op aliases
x=
do case $o in
*) x="$x $o" ;;
esac
done
# loop on the ops o and args a
for o in $x
do c=
case $a in
*[.\\/]*)
case $o in
x=$a
case $x in
case $o in
esac
;;
*) o=${x##*.}
x=${x%.${o}}
;;
esac
v=$x
;;
esac
case $x in
;;
*) eval 'p=${x%/*}'
eval 'v=${x##*/}'
;;
esac
;;
;;
*) eval 'p=${x%.*}'
eval 'v=${x##*.}'
;;
esac
;;
*) p=
;;
esac
case $o in
*) c=$v ;;
esac
;;
;;
*) eval 'p=${a%.*}'
eval 'p=${p##*[\\/]}'
eval 'v=${a##*.}'
eval 'v=${v##*[\\/]}'
;;
esac
;;
esac
case $p in
'') f=${v} ;;
*) f=${p}/${v} ;;
esac
case $o in
run) v=$p
p=
m=_${v}
;;
;;
*) eval 'm=${p#*.}'
eval 'p=${p%%.*}'
;;
esac
v=${m}.${v}
esac
0) m=_${v}_${p} ;;
1) m=_${v}_in_${p} ;;
esac
;;
*) case $p in
'') m=_${v} ;;
*) m=_${p}_${v} ;;
esac
;;
esac
;;
*) p=
v=$a
f=$a
m=_${v}
;;
esac
case $c in
'') c=$v ;;
esac
M=$m
case $o in
-) a=-
;;
?*) test="$a $test"
a=
;;
esac
;;
*" $m "*)
i=1
;;
*" $m "*)
i=0
;;
*) case $m in
esac
case $m in
*[-+/\\]*)
i=0
;;
then success -
i=1
else failure -
i=0
fi
;;
*) i=1
;;
esac
;;
esac
case $i in
0) case $o in
continue
;;
esac
;;
esac
;;
esac
;;
esac
case $m in
m=`echo "X$m" | sed -e 's,^.,,' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g'`
;;
esac
# check output redirection
$cur) ;;
$a|$c) ;;
.) ;;
?*) echo
do API=`echo $api | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
echo "#define ${API}_VERSION ${ver}"
done
esac
do API=`echo $api | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
echo "#define ${API}API(rel) ( _BLD_${api} || !_API_${api} || _API_${api} >= rel )"
map=
sep=
# old solaris requires -k<space><junk> #
case $# in
2) # ancient sort doesn't have -k #
;;
esac
sym=
while :
do shift 2
case $# in
[01]) break ;;
esac
sym=$1
rel=$2
;;
'') echo
echo "#if !defined(_API_${api}) && defined(_API_DEFAULT)"
echo "#define _API_${api} _API_DEFAULT"
echo "#endif"
;;
*) echo "#endif"
;;
esac
echo
echo "#if ${API}API($rel)"
;;
esac
echo "#undef ${sym}"
echo "#define ${sym} ${sym}_${rel}"
sep=' '
done
echo "#endif"
echo
echo "#define _API_${api}_MAP \"$map\""
done
echo
;;
esac
?*) echo "#endif" ;;
esac
-) ;;
*[\\/]*|*.h) x=$cur ;;
esac
;;
;;
esac
esac
else case $x in
esac
fi
;;
esac
;;
esac
1) ;;
*) status=0 ;;
esac
exit $status
;;
-) eval "exec >&$stdout"
;;
*) exec >$tmp.h
;;
esac
"") case $a in
*[\\/]*|???????????????*) cur=$c ;;
*) cur=$a ;;
esac
;;
;;
esac
""|-|+) case $o in
run) x=" from $a" ;;
*) x= ;;
esac
;;
*) x=" from $in"
;;
esac
# output header comments
n) ;;
do echo "#pragma $x"
done
""|-|+) x=$m
;;
;;
*) i=$out
x=_
while :
do case $i in
*.*) eval 'x=$x${i%%.*}_'
eval 'i=${i#*.}'
;;
*) x=$x$i
break
;;
esac
done
;;
esac
;;
*) x=_$out
;;
esac
case $o in
""|*-*) ;;
esac
;;
'') 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
;;
esac
;;
*) case $x in
*-*) ;;
;;
esac
;;
esac
;;
esac
?*) echo "#ifndef $iff"
echo "#define $iff 1"
;;
esac
;;
esac
;;
esac
;;
esac
1) echo "$can" ;;
n) echo "$nan" ;;
esac
can=
nan=
;;
esac
# set up the candidate include list
pre=
inc=
do case $x in
?*) continue ;;
esac
case $v in
#undef $x"
done
;;
*) case $o in
char|short|int|long)
;;
*) pre="#undef $v"
;;
esac
;;
*) pre="#undef $v"
;;
esac
;;
esac
;;
bsh) eval `echo $x | sed -e 's,^\\([^\\\\/]*\\).*[\\\\/]\\([^\\\\/]*\\)\$,\\1_\\2,' -e 's/\\..*//' -e 's/^/c=/'`
;;
*) eval 'c=${x##*[\\/]}'
eval 'c=${c%%.*}'
case $x in
*/*) eval 'c=${x%%[\\/]*}_${c}' ;;
esac
;;
esac
0) case $x in
*/*) c=_${c} ;;
*) c=_hdr_${c} ;;
esac
;;
ksh) typeset -u u=$c ;;
*) u=`echo $c | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
esac
;;
esac
*" $c "*)
;;
;;
esac
#include <$x>"
;;
esac
done
# set up the candidate lib list
ksh) eval 'c=${x#-l}' ;;
esac
case $c in
c=`echo '' $c | sed -e 's,.*[\\\\/],,' -e 's,\.[^.]*$,,' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g' -e '/^lib./s,^lib,,'`
;;
esac
0) c=_LIB_${c}
;;
ksh) typeset -u u=$c ;;
*) u=`echo $c | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
esac
;;
esac
*" $c "*)
;;
;;
esac
done
# src overrides builtin test
0:) case $o in
*) m=_${o}${m} ;;
esac
;;
1:) case $o in
esac
ksh) typeset -u u=$m ;;
*) u=`echo $m | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
esac
case $o in
$u) ;;
*) case $m in
ksh) u=${u#????} ;;
esac
;;
esac
m=HAVE_${u}
;;
esac
;;
ksh) m=${m#_} ;;
esac
;;
*) m=HAVE${u} ;;
esac
;;
*) m=$def
M=$m
;;
esac
$ext"
;;
esac
"
V=1
e=0
;;
;;
;;
else e=1
fi
;;
;;
;;
;;
'') #UNDENT...
echo "$tst
eval set x x $binding
while :
do shift
shift
case $# in
0) break ;;
esac
compile $cc -o ${tmp}s.exe $1 ${tmp}s.o <&$nullin >&$nullout 2>${tmp}s.e && $executable ${tmp}s.exe || continue
$e) ;;
*) continue ;;
esac
compile $cc -o ${tmp}s.exe $2 ${tmp}s.o <&$nullin >&$nullout 2>${tmp}s.e && $executable ${tmp}s.exe || continue
$e) ;;
*) continue ;;
esac
$d) ;;
*) reallystatic=$2
set x
shift
break
;;
esac
done
fi
;;
esac
;;
*) ccflags=
;;
esac
set x $mac
e=1
while :
do o=
shift
while :
do case $# in
0) break ;;
esac
case $1 in
-) break ;;
esac
o="$o $1"
shift
done
if compile $cc $ccflags $o -DTEST=$p -DID=$v -o $tmp.exe $tmp.c $lib $deflib <&$nullin >&$nullout && $executable $tmp.exe
V=$?
case $V in
0) e=1 ;;
*) e=0 ;;
esac
break
;;
[ls]*) e=0 && break ;;
esac
esac
fi
case $# in
no*) e=0 ;;
esac
break
;;
esac
done
;;
esac
o=1
0) e=1 ;;
*) e=0 ;;
esac
;;
esac
esac
;;
esac
continue
;;
esac
# initialize common builtin state
case $o in
case $statictest in
_BEGIN_EXTERNS_
extern int $statictest;
_END_EXTERNS_
int main(){char* i = (char*)&$statictest; return ((unsigned int)i)^0xaaaa;}
"
.) static=
"
eval set x x $binding
while :
do shift
shift
case $# in
0) break ;;
esac
$e) ;;
*) continue ;;
esac
$e) ;;
*) continue ;;
esac
$d) ;;
*) static=$2
set x
shift
break
;;
esac
done
fi
;;
esac
else static=
fi
;;
esac
;;
esac
# builtin tests
case $o in
api) ;;
?*) continue ;;
esac
is $o $a
k=1
do case $j in
"") d= s= ;;
*) d=/$j s=_$j ;;
esac
do if test -f $d/$i/$a
then case $k in
1) k=0
case $M in
*-*) ;;
1) echo "#define $m 1 /* $a in ?(/usr)/(bin|etc|ucb) */" ;;
n) echo "$m=1" ;;
esac
;;
esac
;;
esac
c=${s}_${i}_${v}
1) echo "#define $c 1 /* $d/$i/$a found */" ;;
n) echo "$c=1" ;;
esac
fi
done
done
case $k in
0) success ;;
1) failure ;;
esac
;;
?*) continue ;;
esac
{
copy - "
"
?*) echo "$inc"
;;
*) echo "_BEGIN_EXTERNS_
extern int $v;
_END_EXTERNS_"
;;
esac
echo "
#ifdef _DLL
#define _REF_
#else
#define _REF_ &
#endif
int main(){char* i = (char*) _REF_ $v; return ((unsigned int)i)^0xaaaa;}"
} > $tmp.c
is $o $v
;;
?*) continue ;;
esac
echo "$pre
#ifdef $v
<<\"#ifndef $v\">>
<<\"#define $v\">> $v <<\"/* native $v */\">>
<<\"#endif\">>
#endif" > $tmp.c
if test -s $tmp.t
then success
else failure
fi
else failure
fi
;;
exit 1
;;
esac
case $a in
-|'') ;;
*) eval x='$'$a
case $x in
continue
;;
esac
;;
esac
[01]|'"'*'"'|'<'*'>')
case $a in
-|'') ;;
1) echo "#define $a $test" ;;
n) echo "$a=$test" ;;
esac
eval $a='$test'
;;
esac
;;
esac
'') c=1
;;
x=
for i in `echo '' $test | sed 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_], & ,g'`
do case $i in
[\ \ ])
;;
eval i='${'$i'}'
case $i in
'') i=0
;;
'"'*'"');;
*[!-+0123456789]*)
case $i in
*'"'*) i=1 ;;
*) i='"'$i'"' ;;
esac
;;
esac
x="$x $i"
;;
'!') x="$x 0 ="
;;
*"$i") ;;
*) x="$x \\$i" ;;
esac
;;
*) x="$x \\$i"
;;
esac
done
;;
esac
case $c in
0) c=1 ;;
*) c=0 ;;
esac
M=$a
m=$a
;;
esac
;;
case $o in
*-*) continue ;;
esac
eval x='$'_$m
case $x in
?*) continue ;;
esac
eval _$m=1
is $o $f
echo "$pre
case $f in
sys/*) e= ;;
*) e='-e /[\\\\\/]sys[\\\\\/]'$f'\\.h"/d' ;;
esac
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
;;
echo "$pre
#include <$k>" > $tmp.c
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`
$wj) i=$k ;;
esac
fi
;;
*) echo "$pre
fi
;;
esac
else i=
fi
case $i in
[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]:[\\/]*|[\\/]*)
case $o in
lcl) echo "#if defined(__STDPP__directive)"
echo "__STDPP__directive pragma pp:hosted"
echo "#endif"
echo "#include <$i> /* the native <$f.h> */"
echo "#undef $m"
echo "#define $m 1"
;;
echo "#define ${m}_str \"$i\" /* include string for the native <$f.h> */"
eval $m=\\\<$i\\\>
;;
esac
break
;;
../*/*) success
case $o in
echo "#undef $m"
echo "#define $m 1"
eval $m=1
;;
echo "#define ${m}_str \"$i\" /* include string for the native <$f.h> */"
eval $m=\\\<$i\\\>
;;
esac
break
;;
*) failure
case $o in
1??) echo "#define $m 0 /* no native <$f.h> */" ;;
esac
eval $m=0
;;
esac
;;
esac
;;
esac
;;
*) case $o in
esac
*" - $x "*)
failure +
;;
*" + $x "*)
success +
;;
*) echo "
#include <$x>" > $tmp.c
if is_hdr $x
case $M in
*-*) ;;
*" $m "*)
;;
;;
esac
1) echo "#define $m 1 /* #include <$x> ok */" ;;
n) echo "$m=1" ;;
esac
eval $m=1
;;
esac
case $M in
*-*) ;;
1?1?|1??1)echo "#undef $m /* #include <$x> not ok */" ;;
11??) echo "#define $m 0 /* #include <$x> not ok */" ;;
n1??) echo "$m=0" ;;
esac
eval $m=0
;;
esac
fi
;;
esac
continue
;;
esac
;;
iff) ;;
ini) ;;
?*) continue ;;
esac
w=$v
while :
do is $o $w
echo "$pre
int f(){int $w = 1;return($w);}" > $tmp.c
then failure
*" ="|*" = "*)
set x $set
shift
w=
while :
do case $# in
0) break ;;
esac
case $1 in
=) break ;;
esac
case $w in
'') w=$1 ;;
*) w="$w $1" ;;
esac
shift
done
case $1 in
=) shift
case $# in
0) set=" " ;;
*) set=$* ;;
esac
;;
*) set=
;;
esac
ksh) typeset -u u=$w ;;
*) u=`echo $w | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
esac
u=_$u
M=$w
case $M in
M=`echo "X$m" | sed -e 's,^.,,' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g'`
;;
esac
*) m=_key_${w} ;;
esac
continue
;;
esac
case $M in
*-*) ;;
1$v) ;;
1*) echo "#define $v $w /* alternate for reserved keyword $v */" ;;
n*) echo "$v=$w" ;;
esac
;;
esac
fi
break
done
;;
?*) continue ;;
esac
case $v in
-) continue ;;
esac
is $o $v
typedef int (*_IFFE_fun)();
#ifdef _IFFE_extern
_BEGIN_EXTERNS_
extern int $v();
_END_EXTERNS_
#endif
static _IFFE_fun i=(_IFFE_fun)$v;int main(){return ((unsigned int)i)^0xaaaa;}
"
then d=
then :
else d=error
fi
if test error != "$d"
then case $o in
lib) c=0 ;;
*) c=1 ;;
esac
else case $o in
;;
;;
esac
fi
else case $intrinsic in
_BEGIN_EXTERNS_
extern int foo();
_END_EXTERNS_
static int ((*i)())=foo;int main(){return(i==0);}
"
intrinsic=$?
;;
esac
case $o in
*) report $intrinsic 1 "$v() in default lib(s)" "$v() not in default lib(s)" "default for function $v()" ;;
esac
fi
;;
?*) continue ;;
esac
echo "
#ifdef $v
'$m:$v'
#endif" > $tmp.c
;;
?*) eval i='$'_iffe_typedef_$p
case $i in
0|1) ;;
*) echo "$pre
static $p i;
int n = sizeof(i);" > $tmp.c
then success -
eval _iffe_typedef_$p=1
i=1
else failure -
eval _iffe_typedef_$p=0
i=0
fi
;;
esac
case $i in
0) i="$v is not a member of $p" p="struct $p" ;;
*) i=- ;;
esac
echo "$pre
static $p i;
int n = sizeof(i.$v);" > $tmp.c
;;
*) p=$v
eval i='$'_iffe_typedef_$p
case $i in
0|1) ;;
*) echo "$pre
static $p i;
int n = sizeof(i);" > $tmp.c
then success -
eval _iffe_typedef_$p=1
i=1
else failure -
eval _iffe_typedef_$p=0
i=0
fi
;;
esac
case $i in
0) i="$p is not a non-opaque struct" p="struct $p" ;;
*) i=- ;;
esac
echo "$pre
static $p i;
int n = sizeof(i);" > $tmp.c
then echo "$pre
static $p i;
unsigned long f() { return (unsigned long)i; }" > $tmp.c
then c=1
else c=0
fi
else c=1
fi
esac
;;
nop) ;;
_BEGIN_EXTERNS_
struct _iffe_struct { int _iffe_member; };
#if _STD_
extern struct _iffe_struct* $v(struct _iffe_struct*);
#else
extern struct _iffe_struct* $v();
#endif
_END_EXTERNS_
"
# some compilers with -O only warn for invalid intrinsic prototypes
esac
;;
_BEGIN_EXTERNS_
int _iffe_int = $v / 2;
_END_EXTERNS_
"
;;
do x="#include <$i>"
*" - $i "*)
continue
;;
*" + $i "*)
;;
*) echo "$x" > $tmp.c
if is_hdr $x
continue
fi
;;
esac
"") one=$x
;;
*"$x"*) break
;;
then c=$i
case $c in
esac
?*) break ;;
esac
fi
;;
esac
echo "$x"
break
done
;;
opt) M=$m
case " $PACKAGE_OPTIONS " in
*" $a "*) c=0 ;;
*) c=1 ;;
esac
;;
;;
tab=" "
e=
f=
do case $i in
'{') e="${nl}}"
l=
x=i
v="\$${x}"
b="fnd()${nl}{${t}for ${x} in"
;;
'}') 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"
e="${t}done${e}"
eval "${b}${e}"
fnd $a
case $f in
?*) break ;;
esac
;;
-) b="${b}${t}do${tab}test \"${v}\" = '' -o -d \"${v}\" &&${t}${tab}${tab}"
x=${x}i
v="${v}\$${x}"
b="${b}for ${x} in"
e="${t}done${e}"
t="${t}${tab}${tab}"
;;
*) case $e in
'') if $exists ${i}/${a}
then f=${i}/${a}
break
fi
;;
*) case $i in
/|.) b="${b} ''" ;;
*) b="${b} /${i}" ;;
esac
;;
esac
;;
esac
done
case $f in
' ') f=$a ;;
?*) f=$set ;;
esac
;;
esac
case $f in
'') c=1
;;
*) c=0
f="\"$f\""
;;
esac
report $c "$f" "${note:-$a path}" "$a path not found"
;;
if test ! -r $a
esac
exit 1
fi
case $a in
{
echo "$tst
$inc"
cat $a
} > $tmp.c
;;
*.sh) {
copy - ":
cat $a
;;
*) false
;;
esac
case $? in
0) success
;;
esac
exit 1
;;
esac
;;
"") x= ;;
*) x="$p " ;;
esac
{
case $p:$v in
long:*|*:*[_0123456789]int[_0123456789]*)
echo "$pre
static $x$v i;
$x$v f() {
$x$v v; i = 1; v = i;"
echo "i = v * i; i = i / v; v = v + i; i = i - v;"
case $v in
float|double) ;;
*) echo "v <<= 4; i = v >> 2; i = 10; i = v % i; i |= v; v ^= i; i = 123; v &= i;" ;;
esac
echo "return v; }"
;;
*) echo "$pre
struct xxx { $x$v mem; };
static struct xxx v;
struct xxx* f() { return &v; }"
;;
esac
case $x in
""|"struct "|"union ")
echo "int g() { return 0; }"
;;
*) echo "int g() { return sizeof($x$v)<=sizeof($v); }" ;;
esac
copy - "
int main() {
f();
g();
printf(\"%u\\n\", sizeof($x$v));
return 0;
}"
} > $tmp.c
c=0
else z=0
c=1
fi
report $c "$z" "sizeof($x$v)" "$x$v not a type with known size"
;;
"") x=$v ;;
*) x=$test ;;
esac
echo "$pre
'=' $x '='" > $tmp.c
| sed \
-e "/'='/!d" \
-e "s/'='//g" \
-e 's/[ ]//g' \
-e 's/((([^()]*)))->/->/g' \
-e 's/(([^()]*))->/->/g' \
-e 's/([^()]*)->/->/g' \
-e 's/\([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*\)\[/\
ary \1[/g' \
-e 's/\([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*\)(/\
fun \1[/g' \
-e 's/\*->\([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]\)/->\
ptr \1/g' \
-e 's/->\([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]\)/->\
reg \1/g' \
-e "/^$v\$/d" \
-e 's/^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*$/\
nam &/g' \
| sed \
-e '/^... /!d' \
-u \
| sed \
-e 's/\(...\) \([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*\).*/#ifndef _\1_'$v'\
#define _\1_'$v' \2\
#define _\1_'$v'_str "\2"\
#endif/'
;;
"") x= ;;
*) x="$p " ;;
esac
{
case $p:$v in
long:*|*:*[_0123456789]int[_0123456789]*)
echo "$pre
static $x$v i;
$x$v f() {
$x$v v; i = 1; v = i;"
echo "i = v * i; i = i / v; v = v + i; i = i - v;"
case $v in
float|double) ;;
*) echo "v <<= 4; i = v >> 2; i = 10; i = v % i; i |= v; v ^= i; i = 123; v &= i;" ;;
esac
echo "return v; }"
;;
*) echo "$pre
struct xxx { $x$v mem; };
static struct xxx v;
struct xxx* f() { return &v; }"
;;
esac
case $x in
""|"struct "|"union ")
echo "int main() { f(); return 0; }" ;;
*) echo "int main() { f(); return sizeof($x$v)<=sizeof($v); }" ;;
esac
} > $tmp.c
;;
esac
;;
ver) ;;
;;
;;
:) ;;
-) ;;
status=1
;;
esac
done
done
esac
;;
esac
esac
esac
-) ;;
esac
;;
esac
;;
esac
;;
esac
esac
:*|*:SUCCESS) break ;;
esac
shift
case $1 in
'') shift; break ;;
esac
shift
# set up and try the next group
test=$com_test
while :
do case $1 in
'') shift; break ;;
esac
case $1 in
*[\"\'\(\)\{\}\ \ ]*)
;;
'') test=$1 ;;
*) test="$test $1" ;;
esac
;;
esac
;;
;;
esac
;;
*) eval 'x=-${1#+}' ;;
esac
esac
;;
;;
;;
*) case $1 in
esac
;;
esac
;;
esac
;;
esac
;;
*[.\\/]*)
;;
esac
;;
esac
;;
;;
;;
'') test=$1 ;;
*) test="$test $1" ;;
esac
;;
esac
;;
esac
;;
esac
shift
done
done
done