replace AC_TRY_COMPILE with AC_COMPILE_IFELSE

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14151 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
2004-08-25 14:30:18 +00:00
parent 4cd9bc7b99
commit 4560513573
10 changed files with 38 additions and 41 deletions

View File

@@ -7,9 +7,9 @@ dnl AC_HAVE_STRUCT_FIELD(struct, field, headers)
AC_DEFUN([AC_HAVE_STRUCT_FIELD], [
define(cache_val, translit(ac_cv_type_$1_$2, [A-Z ], [a-z_]))
AC_CACHE_CHECK([for $2 in $1], cache_val,[
AC_TRY_COMPILE([$3],[$1 x; x.$2;],
cache_val=yes,
cache_val=no)])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[$3]],[[$1 x; x.$2]])],
[cache_val=yes],
[cache_val=no])])
if test "$cache_val" = yes; then
define(foo, translit(HAVE_$1_$2, [a-z ], [A-Z_]))
AC_DEFINE(foo, 1, [Define if $1 has field $2.])

View File

@@ -8,16 +8,16 @@ AC_REQUIRE([AC_HEADER_STDC])
cv=`echo "$1" | sed 'y%./+- %__p__%'`
AC_MSG_CHECKING(for $1)
AC_CACHE_VAL([ac_cv_type_$cv],
AC_TRY_COMPILE(
[#include <sys/types.h>
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
$2],
[$1 foo;],
eval "ac_cv_type_$cv=yes",
eval "ac_cv_type_$cv=no"))dnl
$2]],
[[$1 foo;]])],
[eval "ac_cv_type_$cv=yes"],
[eval "ac_cv_type_$cv=no"]))dnl
ac_foo=`eval echo \\$ac_cv_type_$cv`
AC_MSG_RESULT($ac_foo)
if test "$ac_foo" = yes; then

View File

@@ -14,22 +14,22 @@ krb_cv_c_bigendian=yes)
AC_ARG_ENABLE(littleendian,
AS_HELP_STRING([--enable-littleendian],[the target is little endian]),
krb_cv_c_bigendian=no)
AC_CACHE_CHECK(whether byte order is known at compile time,
AC_CACHE_CHECK([whether byte order is known at compile time],
krb_cv_c_bigendian_compile,
[AC_TRY_COMPILE([
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <sys/types.h>
#include <sys/param.h>],[
#include <sys/param.h>]],[[
#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
bogus endian macros
#endif], krb_cv_c_bigendian_compile=yes, krb_cv_c_bigendian_compile=no)])
#endif]])],[krb_cv_c_bigendian_compile=yes],[krb_cv_c_bigendian_compile=no])])
AC_CACHE_CHECK(whether byte ordering is bigendian, krb_cv_c_bigendian,[
if test "$krb_cv_c_bigendian_compile" = "yes"; then
AC_TRY_COMPILE([
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <sys/types.h>
#include <sys/param.h>],[
#include <sys/param.h>]],[[
#if BYTE_ORDER != BIG_ENDIAN
not big endian
#endif], krb_cv_c_bigendian=yes, krb_cv_c_bigendian=no)
#endif]])],[krb_cv_c_bigendian=yes],[krb_cv_c_bigendian=no])
else
AC_TRY_RUN([main () {
/* Are we little or big endian? From Harbison&Steele. */

View File

@@ -9,11 +9,11 @@ AC_DEFUN([KRB_READLINE],[
AC_FIND_FUNC_NO_LIBS(el_init, edit, [], [], [$LIB_tgetent])
if test "$ac_cv_func_el_init" = yes ; then
AC_CACHE_CHECK(for four argument el_init, ac_cv_func_el_init_four,[
AC_TRY_COMPILE([#include <stdio.h>
#include <histedit.h>],
[el_init("", NULL, NULL, NULL);],
ac_cv_func_el_init_four=yes,
ac_cv_func_el_init_four=no)])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
#include <histedit.h>]],
[[el_init("", NULL, NULL, NULL);]])],
[ac_cv_func_el_init_four=yes],
[ac_cv_func_el_init_four=no])])
if test "$ac_cv_func_el_init_four" = yes; then
AC_DEFINE(HAVE_FOUR_VALUED_EL_INIT, 1, [Define if el_init takes four arguments.])
fi

View File

@@ -5,14 +5,13 @@ dnl Test for `struct spwd'
AC_DEFUN([AC_KRB_STRUCT_SPWD], [
AC_MSG_CHECKING(for struct spwd)
AC_CACHE_VAL(ac_cv_struct_spwd, [
AC_TRY_COMPILE(
[#include <pwd.h>
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <pwd.h>
#ifdef HAVE_SHADOW_H
#include <shadow.h>
#endif],
[struct spwd foo;],
ac_cv_struct_spwd=yes,
ac_cv_struct_spwd=no)
#endif]],[[struct spwd foo;]])],
[ac_cv_struct_spwd=yes],
[ac_cv_struct_spwd=no])
])
AC_MSG_RESULT($ac_cv_struct_spwd)

View File

@@ -39,7 +39,7 @@ AC_MSG_CHECKING([if $CC supports the $abi option])
AC_CACHE_VAL($ac_foo, [
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $abi"
AC_TRY_COMPILE(,int x;, eval $ac_foo=yes, eval $ac_foo=no)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]],[[int x;]])],[eval $ac_foo=yes], [eval $ac_foo=no])dnl
CFLAGS="$save_CFLAGS"
])
ac_res=`eval echo \\\$$ac_foo`
@@ -50,7 +50,7 @@ case $abi in
-mabi=32)
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mabi=n32"
AC_TRY_COMPILE(,int x;, ac_res=yes, ac_res=no)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]],[[int x;]])],[ac_res=yes],[ac_res=no])dnl
CLAGS="$save_CFLAGS"
if test $ac_res = yes; then
# New GCC

View File

@@ -9,13 +9,13 @@ dnl AC_NEED_PROTO(includes, function)
AC_DEFUN([AC_NEED_PROTO], [
if test "$ac_cv_func_$2+set" != set -o "$ac_cv_func_$2" = yes; then
AC_CACHE_CHECK([if $2 needs a prototype], ac_cv_func_$2_noproto,
AC_TRY_COMPILE([$1],
[struct foo { int foo; } xx;
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[$1]],
[[struct foo { int foo; } xx;
extern int $2 (struct foo*);
$2(&xx);
],
eval "ac_cv_func_$2_noproto=yes",
eval "ac_cv_func_$2_noproto=no"))
]])],
[eval "ac_cv_func_$2_noproto=yes"],
[eval "ac_cv_func_$2_noproto=no"]))
if test "$ac_cv_func_$2_noproto" = yes; then
AC_DEFINE(AS_TR_CPP(NEED_[]$2[]_PROTO), 1,
[define if the system is missing a prototype for $2()])

View File

@@ -9,10 +9,9 @@ dnl AC_PROTO_COMPAT(includes, function, prototype)
AC_DEFUN([AC_PROTO_COMPAT], [
AC_CACHE_CHECK([if $2 is compatible with system prototype],
ac_cv_func_$2_proto_compat,
AC_TRY_COMPILE([$1],
[$3;],
eval "ac_cv_func_$2_proto_compat=yes",
eval "ac_cv_func_$2_proto_compat=no"))
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[$1]],[[$3]])],
[eval "ac_cv_func_$2_proto_compat=yes"],
[eval "ac_cv_func_$2_proto_compat=no"]))
define([foo], translit($2, [a-z], [A-Z])[_PROTO_COMPATIBLE])
if test "$ac_cv_func_$2_proto_compat" = yes; then
AC_DEFINE(foo, 1, [define if prototype of $2 is compatible with

View File

@@ -101,7 +101,7 @@ if test "$with_$1" != no; then
ires= lres=
for i in $header_dirs; do
CFLAGS="-I$i $save_CFLAGS"
AC_TRY_COMPILE([$2],,ires=$i;break)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[$2]],[[]])],[ires=$i;break])
done
for i in $lib_dirs; do
LIBS="-L$i $3 $4 $save_LIBS"

View File

@@ -6,8 +6,7 @@ dnl
AC_DEFUN([rk_C_VARARRAY], [
AC_CACHE_CHECK([if the compiler supports variable-length arrays],[rk_cv_c_vararray],[
AC_TRY_COMPILE([],
[int x = 0; { int y[x]; }],
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]],[[int x = 0; { int y[x]; }]])],
[rk_cv_c_vararray=yes],
[rk_cv_c_vararray=no])])
if test "$rk_cv_c_vararray" = yes; then