Blame sofort/cfgtest/cfgtest.sh

61f223
# cfgtest.sh: sofort's config test framework,
61f223
# for use from within a project's custom cfgdefs.sh.
61f223
61f223
# this file is covered by COPYING.SOFORT.
61f223
61f223
# in the common scenario, host-specific tests are preceded
61f223
# by a single invocation of cfgtest_host_section, whereas
61f223
# native (build) system tests are preceded by the invocation
61f223
# of cfgtest_native_section.
61f223
61f223
# cfgdefs fraework variables:
61f223
# mb_cfgtest_cc:      the compiler used for the current test
61f223
# mb_cfgtest_cflags:  the compiler flags used for the current test
61f223
# mb_cfgtest_cfgtype: the type of the current test (host/native)
61f223
# mb_cfgtest_makevar: the make variable affected by the current test
61f223
# mb_cfgtest_headers: headers for ad-hoc inclusion with the current test
61f223
61f223
61f223
cfgtest_newline()
61f223
{
61f223
	printf '\n' >> $mb_pwd/cfgdefs.mk
61f223
}
61f223
61f223
61f223
cfgtest_comment()
61f223
{
61f223
	mb_internal_str='#'
61f223
61f223
	for mb_internal_arg ; do
61f223
		mb_internal_str="$mb_internal_str $mb_internal_arg"
61f223
	done
61f223
61f223
	printf '%s\n' "$mb_internal_str" >> $mb_pwd/cfgdefs.mk
61f223
}
61f223
61f223
61f223
cfgtest_host_section()
61f223
{
61f223
	mb_cfgtest_cc="$ccenv_host_cc"
61f223
	mb_cfgtest_cfgtype='host'
61f223
	mb_cfgtest_cflags=$(${mb_make} -n -f "$mb_pwd/Makefile.tmp" .cflags-host)
61f223
	mb_cfgtest_cflags="${mb_cfgtest_cflags#*: }"
61f223
61f223
	mb_cfgtest_ldflags="$mb_ldflags_cmdline"
61f223
	mb_cfgtest_ldflags="$mb_cfgtest_ldflags $mb_ldflags_debug"
61f223
	mb_cfgtest_ldflags="$mb_cfgtest_ldflags $mb_ldflags_common"
61f223
	mb_cfgtest_ldflags="$mb_cfgtest_ldflags $mb_ldflags_strict"
61f223
	mb_cfgtest_ldflags="$mb_cfgtest_ldflags $mb_ldflags_config"
61f223
	mb_cfgtest_ldflags="$mb_cfgtest_ldflags $mb_ldflags_sysroot"
61f223
	mb_cfgtest_ldflags="$mb_cfgtest_ldflags $mb_ldflags_path"
61f223
	mb_cfgtest_ldflags="$mb_cfgtest_ldflags $mb_ldflags_last"
61f223
61f223
	cfgtest_comment 'host-specific tests'
61f223
}
61f223
61f223
61f223
cfgtest_native_section()
61f223
{
61f223
	mb_cfgtest_cc="$mb_native_cc"
61f223
	mb_cfgtest_cfgtype='native'
61f223
	mb_cfgtest_cflags=$(${mb_make} -n -f "$mb_pwd/Makefile.tmp" .cflags-native)
61f223
	mb_cfgtest_cflags="${mb_cfgtest_cflags#*: }"
61f223
	mb_cfgtest_ldflags="$mb_native_ldflags"
61f223
61f223
	cfgtest_comment 'native system tests'
61f223
}
61f223
61f223
61f223
cfgtest_prolog()
61f223
{
61f223
	cfgtest_line_dots='.......................'
61f223
	cfgtest_line_dots="${cfgtest_line_dots}${cfgtest_line_dots}"
61f223
	cfgtest_tool_desc=" == trying ${mb_cfgtest_cfgtype} ${1}: ${2}"
61f223
	cfgtest_tool_dlen="${#cfgtest_line_dots}"
61f223
61f223
	printf '\n%s\n' '________________________' >&3
61f223
	printf "cfgtest: probing for ${mb_cfgtest_cfgtype} ${1}: ${2}\n\n" >&3
61f223
	printf "%${cfgtest_tool_dlen}.${cfgtest_tool_dlen}s" \
61f223
		"${cfgtest_tool_desc}  ${mb_line_dots}"
61f223
}
61f223
61f223
61f223
cfgtest_epilog()
61f223
{
61f223
	cfgtest_line_dots='.......................'
61f223
	cfgtest_tool_dlen="$((${#cfgtest_line_dots} - ${#2}))"
61f223
61f223
	printf "%${cfgtest_tool_dlen}.${cfgtest_tool_dlen}s  %s.\n" \
61f223
		"${cfgtest_line_dots}" "${2}"
61f223
61f223
	if [ "${1}" = 'snippet' ] && [ -f = 'a.out' ]; then
61f223
		rm -f 'a.out'
61f223
	fi
61f223
61f223
	if [ "${1}" = 'snippet' ] && [ "${2}" = '(error)' ]; then
61f223
		printf '\n\ncfgtest: the %s compiler %s %s.\n' \
61f223
			"$mb_cfgtest_cfgtype"                 \
61f223
			'failed to compile the above code'   \
61f223
			"${1}" >&3
61f223
		printf '%s\n' '------------------------' >&3
61f223
		return 1
61f223
	fi
61f223
61f223
	if [ "${2}" = '-----' ]; then
61f223
		printf '\n\ncfgtest: %s %s is missing or cannot be found.\n' "${1}" "${3}" >&3
61f223
		printf '%s\n' '------------------------' >&3
61f223
		return 1
61f223
	elif [ "${1}" = 'size-of-type' ] && [ "${2}" = '(error)' ]; then
61f223
		printf '\n\ncfgtest: could not determine size of type `%s.\n' "${3}'" >&3
61f223
		printf '%s\n' '------------------------' >&3
61f223
		return 1
3efe2d
	elif [ "${1}" = 'switch' ] && [ "${2}" = '(error)' ]; then
3efe2d
		printf '\n\ncfgtest: the switch `%s is not supported by the %s compiler.\n' \
3efe2d
			"${3}'" "$mb_cfgtest_cfgtype" >&3
3efe2d
		printf '%s\n' '------------------------' >&3
3efe2d
		return 1
61f223
	elif [ "${2}" = '(error)' ]; then
61f223
		printf '\n\ncfgtest: %s `%s is not defined or cannot be used.\n' "${1}" "${3}'" >&3
61f223
		printf '%s\n' '------------------------' >&3
61f223
		return 1
61f223
	fi
61f223
}
61f223
61f223
61f223
cfgtest_entity_size_prolog()
61f223
{
61f223
	cfgtest_line_dots='.......................'
61f223
	cfgtest_line_dots="${cfgtest_line_dots}${cfgtest_line_dots}"
61f223
	cfgtest_tool_desc=" == checking size of ${mb_cfgtest_cfgtype} type: ${@}"
61f223
	cfgtest_tool_dlen="${#cfgtest_line_dots}"
61f223
61f223
	printf '\n%s\n' '________________________' >&3
61f223
	printf "cfgtest: checking size of ${mb_cfgtest_cfgtype} type: ${@}\n\n" >&3
61f223
61f223
	printf "%${cfgtest_tool_dlen}.${cfgtest_tool_dlen}s" \
61f223
		"${cfgtest_tool_desc}  ${mb_line_dots}"
61f223
}
61f223
61f223
61f223
cfgtest_makevar_append()
61f223
{
61f223
	mb_internal_str='+='
61f223
61f223
	for mb_internal_arg ; do
61f223
		if ! [ -z "$mb_internal_arg" ]; then
61f223
			mb_internal_str="$mb_internal_str $mb_internal_arg"
61f223
		fi
61f223
	done
61f223
61f223
	printf '%-24s%s\n' "$mb_cfgtest_makevar" "$mb_internal_str" \
61f223
		>> $mb_pwd/cfgdefs.mk
61f223
61f223
	unset cfgtest_internal_unit_test
61f223
}
61f223
61f223
61f223
cfgtest_cflags_append()
61f223
{
61f223
	if [ $mb_cfgtest_cfgtype = 'host' ]; then
61f223
		mb_internal_makevar='CFLAGS_CONFIG'
61f223
	else
61f223
		mb_internal_makevar='NATIVE_CFLAGS'
61f223
	fi
61f223
61f223
	mb_cfgtest_makevar_saved=$mb_cfgtest_makevar
61f223
	mb_cfgtest_makevar=$mb_internal_makevar
61f223
61f223
	cfgtest_makevar_append "$@"
61f223
	mb_cfgtest_makevar=$mb_cfgtest_makevar_saved
61f223
}
61f223
61f223
61f223
cfgtest_ldflags_append()
61f223
{
61f223
	if [ $mb_cfgtest_cfgtype = 'host' ]; then
61f223
		mb_internal_makevar='LDFLAGS_CONFIG'
61f223
	else
61f223
		mb_internal_makevar='NATIVE_LDFLAGS'
61f223
	fi
61f223
61f223
	mb_cfgtest_makevar_saved=$mb_cfgtest_makevar
61f223
	mb_cfgtest_makevar=$mb_internal_makevar
61f223
61f223
	cfgtest_makevar_append "$@"
61f223
	mb_cfgtest_makevar=$mb_cfgtest_makevar_saved
61f223
}
61f223
61f223
61f223
cfgtest_common_init()
61f223
{
61f223
	# cfgtest variables
53eaf3
	cfgtest_type="${1:-}"
53eaf3
53eaf3
	if [ "$cfgtest_type" = 'asm' ]; then
61f223
		cfgtest_fmt='%s -c -xc - -o a.out'
53eaf3
	elif [ "$cfgtest_type" = 'lib' ]; then
61f223
		cfgtest_fmt='%s -xc - -o a.out'
61f223
	else
61f223
		cfgtest_fmt='%s -S -xc - -o -'
61f223
	fi
61f223
3efe2d
53eaf3
	if [ "$cfgtest_type" = 'lib' ]; then
61f223
		cfgtest_cmd=$(printf "$cfgtest_fmt %s %s %s" \
61f223
			"$mb_cfgtest_cc"                     \
61f223
			"$mb_cfgtest_cflags"                 \
61f223
			"$mb_cfgtest_ldflags"                \
61f223
			"$cfgtest_libs")
3efe2d
3efe2d
	elif [ "$cfgtest_type" = 'switch' ]; then
3efe2d
		cfgtest_cmd=$(printf "$cfgtest_fmt %s %s" \
3efe2d
			"$mb_cfgtest_cc"                  \
3efe2d
			"$mb_cfgtest_cflags"              \
3efe2d
			"$cfgtest_switches")
61f223
	else
61f223
		cfgtest_cmd=$(printf "$cfgtest_fmt %s" \
61f223
			"$mb_cfgtest_cc"               \
61f223
			"$mb_cfgtest_cflags")
61f223
	fi
61f223
3efe2d
53eaf3
	if [ -z "$mb_cfgtest_headers" ] || [ "$cfgtest_type" = 'lib' ]; then
61f223
		cfgtest_inc=
61f223
		cfgtest_src="$cfgtest_code_snippet"
3efe2d
3efe2d
	elif [ "$cfgtest_type" = 'switch' ]; then
3efe2d
		cfgtest_inc=
3efe2d
		cfgtest_src=
61f223
	else
61f223
		cfgtest_inc=$(printf '#include <%s>\n' $mb_cfgtest_headers)
61f223
		cfgtest_src=$(printf '%s\n_\n' "$cfgtest_inc" \
61f223
			| m4 -D_="$cfgtest_code_snippet")
61f223
	fi
61f223
3efe2d
61f223
	# config.log
61f223
	printf "$cfgtest_fmt" "$mb_cfgtest_cc" >&3
61f223
61f223
	for cfgtest_cflag in $mb_cfgtest_cflags; do
61f223
		printf ' \\\n\t%s' "$cfgtest_cflag" >&3
61f223
	done
61f223
53eaf3
	if [ "$cfgtest_type" = 'lib' ]; then
61f223
		for cfgtest_lib in $cfgtest_libs; do
61f223
			printf ' \\\n\t%s' "$cfgtest_lib" >&3
61f223
		done
3efe2d
3efe2d
	elif [ "$cfgtest_type" = 'switch' ]; then
3efe2d
		for cfgtest_switch in $cfgtest_switches; do
3efe2d
			printf ' \\\n\t%s' "$cfgtest_switch" >&3
3efe2d
		done
61f223
	fi
61f223
61f223
	printf ' \\\n'                           >&3
61f223
	printf '<< _SRCEOF\n%s\n' "$cfgtest_src" >&3
61f223
	printf '_SRCEOF \n\n\n'                  >&3
61f223
}
61f223
61f223
61f223
cfgtest_header_presence()
61f223
{
61f223
	#init
61f223
	cfgtest_prolog 'header' "${1}"
61f223
61f223
	cfgtest_code_snippet=$(printf '#include <%s>\n' "${1}")
61f223
61f223
	cfgtest_common_init
61f223
61f223
	# execute
61f223
	printf '%s' "$cfgtest_src"                  \
61f223
		| eval $(printf '%s' "$cfgtest_cmd") \
61f223
		> /dev/null 2>&3                      \
61f223
	|| cfgtest_epilog 'header' '-----' "<${1}>"    \
61f223
	|| return
61f223
61f223
	# result
61f223
	mb_internal_str=$(printf '%s%s' '-DHAVE_' "${1}"  \
61f223
			| sed -e 's/\./_/g' -e 's@/@_@g'  \
61f223
			| tr "[:lower:]" "[:upper:]")
61f223
61f223
	if [ -z ${cfgtest_internal_unit_test:-} ]; then
61f223
		cfgtest_cflags_append "$mb_internal_str"
61f223
	else
61f223
		cfgtest_makevar_append "$mb_internal_str"
61f223
	fi
61f223
61f223
	printf 'cfgtest: %s header <%s> was found and may be included.\n' \
61f223
		"$mb_cfgtest_cfgtype" "${1}" >&3
61f223
	printf '%s\n' '------------------------' >&3
61f223
61f223
	cfgtest_epilog 'header' "${1}"
61f223
}
61f223
61f223
61f223
cfgtest_header_absence()
61f223
{
61f223
	#init
61f223
	cfgtest_prolog 'header absence' "${1}"
61f223
61f223
	cfgtest_code_snippet=$(printf '#include <%s>\n' "${1}")
61f223
61f223
	cfgtest_common_init
61f223
61f223
	# execute
61f223
	printf '%s' "$cfgtest_src"                  \
61f223
		| eval $(printf '%s' "$cfgtest_cmd") \
61f223
		> /dev/null 2>&3                      \
61f223
	&& printf 'cfgtest: %s header <%s>: no error.' \
61f223
		"$mb_cfgtest_cfgtype" "${1}" >&3        \
61f223
	&& cfgtest_epilog 'header' "${1}"                \
61f223
	&& return
61f223
61f223
	# result
61f223
	mb_internal_str=$(printf '%s%s' '-DHAVE_NO_' "$@" \
61f223
			| sed -e 's/\./_/g' -e 's@/@_@g'  \
61f223
			| tr "[:lower:]" "[:upper:]")
61f223
61f223
	if [ -z ${cfgtest_internal_unit_test:-} ]; then
61f223
		cfgtest_cflags_append "$mb_internal_str"
61f223
	else
61f223
		cfgtest_makevar_append "$mb_internal_str"
61f223
	fi
61f223
61f223
	printf 'cfgtest: %s header <%s> may not be included.\n' \
61f223
		"$mb_cfgtest_cfgtype" "${1}" >&3
61f223
	printf '%s\n' '------------------------' >&3
61f223
61f223
	cfgtest_epilog 'header' '-----'
61f223
}
61f223
61f223
61f223
cfgtest_interface_presence()
61f223
{
61f223
	# init
61f223
	cfgtest_prolog 'interface' "${1}"
61f223
61f223
	cfgtest_code_snippet=$(printf 'void * addr = &%;;\n' "${1}")
61f223
61f223
	cfgtest_common_init
61f223
61f223
	# execute
61f223
	printf '%s' "$cfgtest_src"                    \
61f223
		| eval $(printf '%s' "$cfgtest_cmd")   \
61f223
		> /dev/null 2>&3                        \
61f223
	|| cfgtest_epilog 'interface' '(error)' "${1}"   \
61f223
	|| return
61f223
61f223
	# result
61f223
	mb_internal_str=$(printf '%s%s' '-DHAVE_' "$@"  \
61f223
			| sed -e 's/\./_/g'             \
61f223
			| tr "[:lower:]" "[:upper:]")
61f223
61f223
	if [ -z ${cfgtest_internal_unit_test:-} ]; then
61f223
		cfgtest_cflags_append "$mb_internal_str"
61f223
	else
61f223
		cfgtest_makevar_append "$mb_internal_str"
61f223
	fi
61f223
61f223
	printf 'cfgtest: %s interface `%s'"'"' is available.\n' \
61f223
		"$mb_cfgtest_cfgtype" "${1}" >&3
61f223
	printf '%s\n' '------------------------' >&3
61f223
61f223
	cfgtest_epilog 'interface' "${1}"
61f223
61f223
	return 0
61f223
}
61f223
61f223
61f223
cfgtest_decl_presence()
61f223
{
61f223
	# init
61f223
	cfgtest_prolog 'decl' "${1}"
61f223
61f223
	cfgtest_code_snippet=$(printf 'void * any = (void *)(%s);' "${1}")
61f223
61f223
	cfgtest_common_init
61f223
61f223
	# execute
61f223
	printf '%s' "$cfgtest_src"                  \
61f223
		| eval $(printf '%s' "$cfgtest_cmd") \
61f223
		> /dev/null 2>&3                      \
61f223
	|| cfgtest_epilog 'decl' '(error)' "${1}"      \
61f223
	|| return
61f223
61f223
	# does the argument solely consist of the macro or enum member name?
61f223
	mb_internal_str=$(printf '%s' "$@" | tr -d '[a-z][A-Z][0-9][_]')
61f223
61f223
	if [ -n "$mb_internal_str" ]; then
61f223
		cfgtest_epilog 'decl' '(defined)'
61f223
		return 0
61f223
	fi
61f223
61f223
	# result
61f223
	mb_internal_str=$(printf '%s%s' '-DHAVE_DECL_' "$@"  \
61f223
			| sed -e 's/\./_/g'                  \
61f223
			| tr "[:lower:]" "[:upper:]")
61f223
61f223
	if [ -z ${cfgtest_internal_unit_test:-} ]; then
61f223
		cfgtest_cflags_append "$mb_internal_str"
61f223
	else
61f223
		cfgtest_makevar_append "$mb_internal_str"
61f223
	fi
61f223
61f223
	printf 'cfgtest: `%s'"'"' is defined for the %s system.\n' \
61f223
		"${1}" "$mb_cfgtest_cfgtype" >&3
61f223
	printf '%s\n' '------------------------' >&3
61f223
61f223
	cfgtest_epilog 'decl' '(defined)'
61f223
61f223
	return 0
61f223
}
61f223
61f223
61f223
cfgtest_type_size()
61f223
{
61f223
	cfgtest_entity_size_prolog "$@"
61f223
61f223
	mb_internal_size=''
61f223
	mb_internal_test='char x[(sizeof(%s) == %s) ? 1 : -1];'
61f223
61f223
	for mb_internal_guess in 8 4 2 1 16 32 64 128; do
61f223
		if [ -z $mb_internal_size ]; then
61f223
			printf '# guess %s ===>\n' "$mb_internal_guess" >&3
61f223
61f223
			mb_internal_type="$@"
61f223
61f223
			cfgtest_code_snippet=$(printf "$mb_internal_test" \
61f223
				"$mb_internal_type" "$mb_internal_guess")
61f223
61f223
			cfgtest_common_init
61f223
61f223
			printf '%s' "$cfgtest_src"                  \
61f223
				| eval $(printf '%s' "$cfgtest_cmd") \
61f223
				> /dev/null 2>&3                      \
61f223
			&& mb_internal_size=$mb_internal_guess
61f223
61f223
			printf '\n' >&3
61f223
		fi
61f223
	done
61f223
61f223
	# unrecognized type, or type size not within range
61f223
	if [ -z $mb_internal_size ]; then
61f223
		cfgtest_epilog 'size-of-type' '(error)' "@"
61f223
		return 1
61f223
	fi
61f223
61f223
	# -DSIZEOF_TYPE=SIZE
61f223
	mb_internal_str=$(printf '%s%s=%s' '-DSIZEOF_'        \
61f223
				"$mb_internal_type"           \
61f223
				"$mb_internal_size"           \
61f223
			| sed -e 's/\ /_/g' -e 's/*/P/g'      \
61f223
			| tr "[:lower:]" "[:upper:]")
61f223
61f223
	if [ -z ${cfgtest_internal_unit_test:-} ]; then
61f223
		cfgtest_cflags_append "$mb_internal_str"
61f223
	else
61f223
		cfgtest_makevar_append "$mb_internal_str"
61f223
	fi
61f223
61f223
	printf 'cfgtest: size of type `%s'"'"' determined to be %s\n' \
61f223
		"${@}" "$mb_internal_size" >&3
61f223
	printf '%s\n' '------------------------' >&3
61f223
61f223
	cfgtest_epilog 'size-of-type' "$mb_internal_size"
61f223
61f223
	return 0
61f223
}
61f223
61f223
61f223
cfgtest_code_snippet_asm()
61f223
{
61f223
	# init
61f223
	cfgtest_prolog 'support of code snippet' '<...>'
61f223
61f223
	cfgtest_code_snippet="$@"
61f223
61f223
	cfgtest_common_init 'asm'
61f223
61f223
	# execute
61f223
	cfgtest_ret=1
61f223
61f223
	printf '%s' "$cfgtest_src"                  \
61f223
		| eval $(printf '%s' "$cfgtest_cmd") \
61f223
		> /dev/null 2>&3                      \
61f223
	|| cfgtest_epilog 'snippet' '(error)'          \
61f223
	|| return
61f223
61f223
	# result
61f223
	cfgtest_ret=0
61f223
61f223
	printf 'cfgtest: %s compiler: above code snippet compiled successfully.\n\n' \
61f223
		"$mb_cfgtest_cfgtype" >&3
61f223
61f223
	cfgtest_epilog 'snippet' '(ok)'
61f223
61f223
	return 0
61f223
}
61f223
61f223
61f223
cfgtest_library_presence()
61f223
{
61f223
	# init
61f223
	cfgtest_libs=
61f223
	cfgtest_spc=
61f223
61f223
	for cfgtest_lib in ${@}; do
61f223
		cfgtest_libs="$cfgtest_libs$cfgtest_spc$cfgtest_lib"
61f223
		cfgtest_spc=' '
61f223
	done
61f223
61f223
	if [ "${1}" = "$cfgtest_libs" ]; then
61f223
		cfgtest_prolog 'library' "${1#*-l}"
61f223
	else
61f223
		cfgtest_prolog 'lib module' '(see config.log)'
61f223
	fi
61f223
61f223
	cfgtest_code_snippet='int main(void){return 0;}'
61f223
61f223
	cfgtest_common_init 'lib'
61f223
61f223
	# execute
61f223
	printf '%s' "$cfgtest_src"                  \
61f223
		| eval $(printf '%s' "$cfgtest_cmd") \
61f223
		> /dev/null 2>&3                      \
61f223
	|| cfgtest_epilog 'library' '-----' "$@"       \
61f223
	|| return 1
61f223
61f223
	# result
61f223
	printf 'cfgtest: `%s'"'"' was accepted by the linker driver.\n' \
61f223
		"$cfgtest_libs" >&3
61f223
	printf '%s\n' '------------------------' >&3
61f223
61f223
	cfgtest_epilog 'library' '(present)'
61f223
61f223
	return 0
61f223
}
61f223
61f223
3efe2d
cfgtest_compiler_switch()
3efe2d
{
3efe2d
	# init
3efe2d
	cfgtest_switches=
3efe2d
	cfgtest_spc=
3efe2d
3efe2d
	for cfgtest_switch in ${@}; do
3efe2d
		cfgtest_switches="$cfgtest_switches$cfgtest_spc$cfgtest_switch"
3efe2d
		cfgtest_spc=' '
3efe2d
	done
3efe2d
3efe2d
	if [ "${1}" = "$cfgtest_switches" ]; then
3efe2d
		cfgtest_prolog 'compiler switch' "$cfgtest_switches"
3efe2d
	else
3efe2d
		cfgtest_prolog 'compiler switch combination' "$cfgtest_switches"
3efe2d
	fi
3efe2d
3efe2d
	cfgtest_code_snippet=
3efe2d
3efe2d
	cfgtest_common_init 'switch'
3efe2d
3efe2d
	# execute
3efe2d
	printf '%s' "$cfgtest_src"                  \
3efe2d
		| eval $(printf '%s' "$cfgtest_cmd") \
3efe2d
		> /dev/null 2>&3                      \
3efe2d
	|| cfgtest_epilog 'switch' '(error)' "$@"      \
3efe2d
	|| return 1
3efe2d
3efe2d
	# result
3efe2d
	printf 'cfgtest: the switch `%s was accepted by the compier.\n' \
3efe2d
		"$cfgtest_switches'" >&3
3efe2d
	printf '%s\n' '------------------------' >&3
3efe2d
3efe2d
	cfgtest_epilog 'switch' '(accepted)'
3efe2d
3efe2d
	return 0
3efe2d
}
3efe2d
3efe2d
61f223
cfgtest_unit_header_presence()
61f223
{
61f223
	cfgtest_internal_unit_test='unit_test'
61f223
	cfgtest_header_presence "$@" || return 1
61f223
	return 0
61f223
}
61f223
61f223
61f223
cfgtest_unit_header_absence()
61f223
{
61f223
	cfgtest_internal_unit_test='unit_test'
61f223
	cfgtest_header_absence "$@" || return 1
61f223
	return 0
61f223
}
61f223
61f223
61f223
cfgtest_unit_interface_presence()
61f223
{
61f223
	cfgtest_internal_unit_test='unit_test'
61f223
	cfgtest_interface_presence "$@" || return 1
61f223
	return 0
61f223
}
61f223
61f223
61f223
cfgtest_unit_decl_presence()
61f223
{
61f223
	cfgtest_internal_unit_test='unit_test'
61f223
	cfgtest_decl_presence "$@" || return 1
61f223
	return 0
61f223
}
61f223
61f223
61f223
cfgtest_unit_type_size()
61f223
{
61f223
	cfgtest_internal_unit_test='unit_test'
61f223
	cfgtest_type_size "$@" || return 1
61f223
	return 0
61f223
}