AC_PREREQ(2.13)
AC_DEFUN([CL_CPP_CHECK],
[AC_MSG_CHECKING(for $1)
AC_CACHE_VAL($2,[
AC_TRY_CPP([$3], $2=yes, $2=no)
])
AC_MSG_RESULT([$]$2)
if test [$]$2 = yes; then
ifelse([$4], , :, [$4])
ifelse([$5], , , [else
$5
])fi
])
AC_DEFUN([CL_COMPILE_CHECK],
[AC_MSG_CHECKING(for $1)
AC_CACHE_VAL($2,[
AC_TRY_COMPILE([$3],[$4], $2=yes, $2=no)
])
AC_MSG_RESULT([$]$2)
if test [$]$2 = yes; then
ifelse([$5], , :, [$5])
ifelse([$6], , , [else
$6
])fi
])
AC_DEFUN([CL_LINK_CHECK],
[AC_MSG_CHECKING(for $1)
AC_CACHE_VAL($2,[
AC_TRY_LINK([$3],[$4], $2=yes, $2=no)
])
AC_MSG_RESULT([$]$2)
if test [$]$2 = yes; then
ifelse([$5], , :, [$5])
ifelse([$6], , , [else
$6
])fi
])
AC_DEFUN([CL_SILENT],
[pushdef([AC_MSG_CHECKING],[:])pushdef([AC_CHECKING],[:])pushdef([AC_MSG_RESULT],[:])$1[]popdef([AC_MSG_RESULT])popdef([AC_CHECKING])popdef([AC_MSG_CHECKING])])
AC_DEFUN([AC_LANG_EXTERN],
[extern
"C"
])
AC_DEFUN([CL_CC_WORKS],
[AC_CACHE_CHECK(whether CC works at all, cl_cv_prog_cc_works, [
AC_LANG_SAVE()
AC_LANG_C()
AC_TRY_RUN([int main() { exit(0); }],
cl_cv_prog_cc_works=yes, cl_cv_prog_cc_works=no,
AC_TRY_LINK([], [], cl_cv_prog_cc_works=yes, cl_cv_prog_cc_works=no))
AC_LANG_RESTORE()
])
case "$cl_cv_prog_cc_works" in
*no) echo "Installation or configuration problem: C compiler cannot create executables."; exit 1;;
*yes) ;;
esac
])
AC_DEFUN([CL_CONFIG_SUBDIRS],
[AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])
AC_CONFIG_SUBDIRS([$1])])
AC_DEFUN([CL_CANONICAL_HOST],
[AC_REQUIRE([AC_PROG_CC]) ac_aux_dir=${srcdir}/$1
ac_config_guess="$SHELL $ac_aux_dir/config.guess"
ac_config_sub="$SHELL $ac_aux_dir/config.sub"
AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])AC_CANONICAL_BUILD
AC_CANONICAL_HOST
])
AC_DEFUN([CL_CANONICAL_HOST_CPU],
[AC_REQUIRE([CL_CANONICAL_HOST])AC_REQUIRE([AC_PROG_CC])
case "$host_cpu" in
changequote(,) i[4567]86 )
host_cpu=i386
;;
alphaev[4-7] | alphaev56 | alphapca5[67] | alphaev6[78] )
host_cpu=alpha
;;
hppa1.0 | hppa1.1 | hppa2.0* )
host_cpu=hppa
;;
powerpc )
host_cpu=rs6000
;;
c1 | c2 | c32 | c34 | c38 | c4 )
host_cpu=convex
;;
arm* )
host_cpu=arm
;;
changequote([,]) mips )
AC_CACHE_CHECK([for 64-bit MIPS], cl_cv_host_mips64, [
AC_EGREP_CPP(yes,
[/* We should also check for (_MIPS_SZPTR == 64), but gcc keeps this at 32. */
yes
], cl_cv_host_mips64=yes, cl_cv_host_mips64=no)
])
if test $cl_cv_host_mips64 = yes; then
host_cpu=mips64
fi
;;
sparc | sparc64 )
AC_CACHE_CHECK([for 64-bit SPARC], cl_cv_host_sparc64, [
AC_EGREP_CPP(yes,
[ yes
], cl_cv_host_sparc64=yes, cl_cv_host_sparc64=no)
])
if test $cl_cv_host_sparc64 = yes; then
host_cpu=sparc64
else
host_cpu=sparc
fi
;;
esac
cat >> confdefs.h <<EOF
EOF
])
AC_DEFUN([CL_CANONICAL_HOST_CPU_FOR_FFCALL],
[AC_REQUIRE([CL_CANONICAL_HOST])AC_REQUIRE([AC_PROG_CC])
case "$host_cpu" in
changequote(,) i[4567]86 )
host_cpu=i386
;;
alphaev[4-7] | alphaev56 | alphapca5[67] | alphaev6[78] )
host_cpu=alpha
;;
hppa1.0 | hppa1.1 | hppa2.0* )
host_cpu=hppa
;;
powerpc )
host_cpu=rs6000
;;
c1 | c2 | c32 | c34 | c38 | c4 )
host_cpu=convex
;;
arm* )
host_cpu=arm
;;
changequote([,]) mips )
AC_CACHE_CHECK([for 64-bit MIPS], cl_cv_host_mips64, [
AC_EGREP_CPP(yes,
[/* We should also check for (_MIPS_SZPTR == 64), but gcc keeps this at 32. */
yes
], cl_cv_host_mips64=yes, cl_cv_host_mips64=no)
])
if test $cl_cv_host_mips64 = yes; then
host_cpu=mips64
else
AC_CACHE_CHECK([for MIPS with n32 ABI], cl_cv_host_mipsn32, [
AC_EGREP_CPP(yes,
[ yes
], cl_cv_host_mipsn32=yes, cl_cv_host_mipsn32=no)
])
if test $cl_cv_host_mipsn32 = yes; then
host_cpu=mipsn32
fi
fi
;;
sparc | sparc64 )
AC_CACHE_CHECK([for 64-bit SPARC], cl_cv_host_sparc64, [
AC_EGREP_CPP(yes,
[ yes
], cl_cv_host_sparc64=yes, cl_cv_host_sparc64=no)
])
if test $cl_cv_host_sparc64 = yes; then
host_cpu=sparc64
else
host_cpu=sparc
fi
;;
esac
cat >> confdefs.h <<EOF
EOF
])