Reicher82 / toolchain / sbmake

Forked from toolchain/sbmake 3 years ago
Clone

Blame sofort/cfgtest/cfgtest.sh

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