AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_BUILD],
[AC_REQUIRE([AC_CANONICAL_BUILD]) []case ${build_alias} in
"") build_noncanonical=${build} ;;
*) build_noncanonical=${build_alias} ;;
esac
]) []
AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_HOST],
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []case ${host_alias} in
"") host_noncanonical=${build_noncanonical} ;;
*) host_noncanonical=${host_alias} ;;
esac
]) []
AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_TARGET],
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_HOST]) []case ${target_alias} in
"") target_noncanonical=${host_noncanonical} ;;
*) target_noncanonical=${target_alias} ;;
esac
]) []
AC_DEFUN([ACX_NONCANONICAL_BUILD],
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []AC_SUBST(build_noncanonical)
]) []
AC_DEFUN([ACX_NONCANONICAL_HOST],
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_HOST]) []AC_SUBST(host_noncanonical)
]) []
AC_DEFUN([ACX_NONCANONICAL_TARGET],
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_TARGET]) []AC_SUBST(target_noncanonical)
]) []
AC_DEFUN([GCC_TOPLEV_SUBDIRS],
[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_TARGET]) []AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []
build_subdir="build-${build_noncanonical}"
AC_ARG_WITH(build-libsubdir,
[ --with-build-libsubdir=[DIR] Directory where to find libraries for build system],
build_libsubdir="$withval",
build_libsubdir="$build_subdir")
if ( test $srcdir = . && test -d gcc ) \
|| test -d $srcdir/../host-${host_noncanonical}; then
host_subdir="host-${host_noncanonical}"
else
host_subdir=.
fi
target_subdir=${target_noncanonical}
AC_SUBST([build_libsubdir]) []AC_SUBST([build_subdir]) []AC_SUBST([host_subdir]) []AC_SUBST([target_subdir]) []]) []
AC_DEFUN([_NCN_TOOL_PREFIXES],
[ncn_tool_prefix=
test -n "$host_alias" && ncn_tool_prefix=$host_alias-
ncn_target_tool_prefix=
test -n "$target_alias" && ncn_target_tool_prefix=$target_alias-
]) []
AC_DEFUN([NCN_STRICT_CHECK_TOOLS],
[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []for ncn_progname in $2; do
if test -n "$ncn_tool_prefix"; then
AC_CHECK_PROG([$1], [${ncn_tool_prefix}${ncn_progname}],
[${ncn_tool_prefix}${ncn_progname}], , [$4])
fi
if test -z "$ac_cv_prog_$1" && test $build = $host ; then
AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4])
fi
test -n "$ac_cv_prog_$1" && break
done
if test -z "$ac_cv_prog_$1" ; then
ifelse([$3],[], [set dummy $2
if test $build = $host ; then
$1="[$]2"
else
$1="${ncn_tool_prefix}[$]2"
fi], [$1="$3"])
fi
]) []
AC_DEFUN([NCN_STRICT_CHECK_TARGET_TOOLS],
[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []if test -n "$with_build_time_tools"; then
for ncn_progname in $2; do
AC_MSG_CHECKING([for ${ncn_progname} in $with_build_time_tools])
if test -x $with_build_time_tools/${ncn_progname}; then
ac_cv_prog_$1=$with_build_time_tools/${ncn_progname}
AC_MSG_RESULT(yes)
break
else
AC_MSG_RESULT(no)
fi
done
fi
if test -z "$ac_cv_prog_$1"; then
for ncn_progname in $2; do
if test -n "$ncn_target_tool_prefix"; then
AC_CHECK_PROG([$1], [${ncn_target_tool_prefix}${ncn_progname}],
[${ncn_target_tool_prefix}${ncn_progname}], , [$4])
fi
if test -z "$ac_cv_prog_$1" && test $build = $target ; then
AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4])
fi
test -n "$ac_cv_prog_$1" && break
done
fi
if test -z "$ac_cv_prog_$1" ; then
ifelse([$3],[], [set dummy $2
if test $build = $target ; then
$1="[$]2"
else
$1="${ncn_target_tool_prefix}[$]2"
fi], [$1="$3"])
else
$1="$ac_cv_prog_$1"
fi
]) []
AC_DEFUN([ACX_PATH_SEP], [
if test "${PATH_SEPARATOR+set}" != set; then
echo " echo "exit 0" >>conf$$.sh
chmod +x conf$$.sh
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
rm -f conf$$.sh
fi
])
AC_DEFUN([ACX_TOOL_DIRS], [
AC_REQUIRE([ACX_PATH_SEP])
if test "x$exec_prefix" = xNONE; then
if test "x$prefix" = xNONE; then
gcc_cv_tool_prefix=$ac_default_prefix
else
gcc_cv_tool_prefix=$prefix
fi
else
gcc_cv_tool_prefix=$exec_prefix
fi
if test x$host = x$build && test -f $srcdir/gcc/BASE-VER; then
gcc_version=`cat $srcdir/gcc/BASE-VER`
gcc_cv_tool_dirs="$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical$PATH_SEPARATOR"
gcc_cv_tool_dirs="$gcc_cv_tool_dirs/usr/lib/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
gcc_cv_tool_dirs="$gcc_cv_tool_dirs/usr/lib/gcc/$target_noncanonical$PATH_SEPARATOR"
gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/$target_noncanonical/bin/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/$target_noncanonical/bin$PATH_SEPARATOR"
else
gcc_cv_tool_dirs=
fi
if test x$build = x$target && test -n "$md_exec_prefix"; then
gcc_cv_tool_dirs="$gcc_cv_tool_dirs$md_exec_prefix$PATH_SEPARATOR"
fi
]) []
AC_DEFUN([ACX_HAVE_GCC_FOR_TARGET], [
cat > conftest.c << \EOF
gcc_yay;
EOF
if ($GCC_FOR_TARGET -E conftest.c | grep gcc_yay) > /dev/null 2>&1; then
have_gcc_for_target=yes
else
GCC_FOR_TARGET=${ncn_target_tool_prefix}gcc
have_gcc_for_target=no
fi
rm conftest.c
])
AC_DEFUN([ACX_CHECK_INSTALLED_TARGET_TOOL], [
AC_REQUIRE([ACX_TOOL_DIRS])
AC_REQUIRE([ACX_HAVE_GCC_FOR_TARGET])
if test -z "$ac_cv_path_$1" ; then
if test -n "$with_build_time_tools"; then
AC_MSG_CHECKING([for $2 in $with_build_time_tools])
if test -x $with_build_time_tools/$2; then
$1=`cd $with_build_time_tools && pwd`/$2
ac_cv_path_$1=[$]$1
AC_MSG_RESULT([$ac_cv_path_$1])
else
AC_MSG_RESULT(no)
fi
elif test $build != $host && test $have_gcc_for_target = yes; then
$1=`$GCC_FOR_TARGET --print-prog-name=$2`
test [$]$1=$2 && $1=
test -n "[$]$1" && ac_cv_path_$1=[$]$1
fi
fi
if test -z "$ac_cv_path_$1" ; then
AC_PATH_PROG([$1], [$2], [], [$gcc_cv_tool_dirs])
fi
if test -z "$ac_cv_path_$1" ; then
NCN_STRICT_CHECK_TARGET_TOOLS([$1], [$2])
else
$1=$ac_cv_path_$1
fi
]) []
AC_DEFUN([AC_PROG_CPP_WERROR],
[AC_REQUIRE([AC_PROG_CPP])m4_define([AC_CHECK_HEADER],m4_defn([_AC_CHECK_HEADER_OLD]))
ac_c_preproc_warn_flag=yes])
AC_DEFUN([ACX_PROG_GNAT],
[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])
AC_REQUIRE([AC_PROG_CC])
AC_CHECK_TOOL(GNATBIND, gnatbind, no)
AC_CACHE_CHECK([whether compiler driver understands Ada],
acx_cv_cc_gcc_supports_ada,
[cat >conftest.adb <<EOF
procedure conftest is begin null; end conftest;
EOF
acx_cv_cc_gcc_supports_ada=no
errors=`(${CC} -c conftest.adb) 2>&1 || echo failure`
if test x"$errors" = x && test -f conftest.$ac_objext; then
acx_cv_cc_gcc_supports_ada=yes
fi
rm -f conftest.*])
if test x$GNATBIND != xno && test x$acx_cv_cc_gcc_supports_ada != xno; then
have_gnat=yes
else
have_gnat=no
fi
])
AC_DEFUN([ACX_PROG_CMP_IGNORE_INITIAL],
[AC_CACHE_CHECK([how to compare bootstrapped objects], gcc_cv_prog_cmp_skip,
[ echo abfoo >t1
echo cdfoo >t2
gcc_cv_prog_cmp_skip='tail +16c $$f1 > tmp-foo1; tail +16c $$f2 > tmp-foo2; cmp tmp-foo1 tmp-foo2'
if cmp t1 t2 2 2 > /dev/null 2>&1; then
if cmp t1 t2 1 1 > /dev/null 2>&1; then
:
else
gcc_cv_prog_cmp_skip='cmp $$f1 $$f2 16 16'
fi
fi
if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then
if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then
:
else
gcc_cv_prog_cmp_skip='cmp --ignore-initial=16 $$f1 $$f2'
fi
fi
rm t1 t2
])
do_compare="$gcc_cv_prog_cmp_skip"
AC_SUBST(do_compare)
])
AC_DEFUN([ACX_HEADER_STRING],
[AC_CACHE_CHECK([whether string.h and strings.h may both be included],
gcc_cv_header_string,
[AC_TRY_COMPILE([if test $gcc_cv_header_string = yes; then
AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.])
fi
])
AC_DEFUN([ACX_HEADER_STDBOOL],
[AC_CACHE_CHECK([for working stdbool.h],
ac_cv_header_stdbool_h,
[AC_TRY_COMPILE([[bool foo = false;],
ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)])
if test $ac_cv_header_stdbool_h = yes; then
AC_DEFINE(HAVE_STDBOOL_H, 1,
[Define if you have a working <stdbool.h> header file.])
fi
AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
[AC_TRY_COMPILE(,
[_Bool foo;],
gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
])
if test $gcc_cv_c__bool = yes; then
AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
fi
])
AC_DEFUN([ACX_PROG_LN],
[AC_MSG_CHECKING(whether ln works)
AC_CACHE_VAL(acx_cv_prog_LN,
[rm -f conftestdata_t
echo >conftestdata_f
if ln conftestdata_f conftestdata_t 2>/dev/null
then
acx_cv_prog_LN=ln
else
acx_cv_prog_LN=no
fi
rm -f conftestdata_f conftestdata_t
])if test $acx_cv_prog_LN = no; then
LN="ifelse([$1],,cp,[$1])"
AC_MSG_RESULT([no, using $LN])
else
LN="$acx_cv_prog_LN"
AC_MSG_RESULT(yes)
fi
AC_SUBST(LN)])
AC_DEFUN([GCC_TARGET_TOOL],
[AC_MSG_CHECKING(where to find the target $1)
if test "x${build}" != "x${host}" ; then
if expr "x[$]$2" : "x/" > /dev/null; then
AC_MSG_RESULT(pre-installed in `dirname [$]$2`)
else
AC_MSG_RESULT(pre-installed)
fi
else
ifelse([$4],,,
[ok=yes
case " ${configdirs} " in
*" patsubst([$4], [/.*], []) "*) ;;
*) ok=no ;;
esac
ifelse([$5],,,
[case ,${enable_languages}, in
*,$5,*) ;;
*) ok=no ;;
esac])
if test $ok = yes; then
$2='$$r/$(HOST_SUBDIR)/$4'
AC_MSG_RESULT(just compiled)
el])if expr "x[$]$2" : "x/" > /dev/null; then
AC_MSG_RESULT(pre-installed in `dirname [$]$2`)
elif test "x$target" = "x$host"; then
$2='$($3)'
AC_MSG_RESULT(host tool)
else
AC_MSG_RESULT(pre-installed)
fi
fi])
AC_DEFUN([ACX_CHECK_PROG_VER],[
AC_CHECK_PROG([$1], [$2], [$2])
if test -n "[$]$1"; then
AC_CACHE_CHECK([for modern $2],
[gcc_cv_prog_$2_modern],
[ac_prog_version=`eval [$]$1 $3 2>&1 |
sed -n 's/^.*patsubst([[$4]],/,\/).*$/\1/p'`
[case $ac_prog_version in
'') gcc_cv_prog_$2_modern=no;;
$5) gcc_cv_prog_$2_modern=yes;;
*) gcc_cv_prog_$2_modern=no;;
esac]
if test $gcc_cv_prog_$2_modern = no; then
$1="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing $2"
fi
])
else
gcc_cv_prog_$2_modern=no
fi
])