AC_CHECK_FILES has never worked properly.

* acgeneral.m4 (AC_CHECK_FILE): Use AC_CACHE_CHECK.
* autoheader.m4 (AC_CHECK_FILES): AH-define.
* tests/semantics.m4: Test AC_CHECK_FILES.
* tests/atspecific.m4 (TEST_MACRO): Don't.
This commit is contained in:
Akim Demaille 2000-02-10 09:40:55 +00:00
parent abe94c7473
commit d6ef78697d
5 changed files with 57 additions and 32 deletions

View File

@ -1,3 +1,12 @@
2000-02-10 Akim Demaille <akim@epita.fr>
AC_CHECK_FILES has never worked properly.
* acgeneral.m4 (AC_CHECK_FILE): Use AC_CACHE_CHECK.
* autoheader.m4 (AC_CHECK_FILES): AH-define.
* tests/semantics.m4: Test AC_CHECK_FILES.
* tests/atspecific.m4 (TEST_MACRO): Don't.
2000-02-10 Akim Demaille <akim@epita.fr>
No longer use a diversion to store the sed program implementing

View File

@ -1696,6 +1696,7 @@ define(AC_SUBST_FILE,
s%@$1@%%;t t])])
## --------------------------------------- ##
## Printing messages at autoconf runtime. ##
## --------------------------------------- ##
@ -2633,29 +2634,22 @@ done
#
# Check for the existence of FILE.
AC_DEFUN(AC_CHECK_FILE,
[AC_VAR_PUSHDEF([ac_var], [ac_cv_file_$1])dnl
[AC_VAR_PUSHDEF([ac_File], [ac_cv_file_$1])dnl
dnl FIXME: why was there this line? AC_REQUIRE([AC_PROG_CC])dnl
AC_MSG_CHECKING([for $1])
AC_CACHE_VAL(ac_var,
AC_CACHE_CHECK([for $1], ac_File,
[if test "$cross_compiling" = yes; then
AC_WARNING([Cannot check for file existence when cross compiling])dnl
AC_MSG_ERROR([Cannot check for file existence when cross compiling])
fi
if test -r "[$1]"; then
AC_VAR_SET(ac_var, yes)
AC_VAR_SET(ac_File, yes)
else
AC_VAR_SET(ac_var, no)
fi])dnl
if test AC_VAR_GET(ac_var) = yes; then
AC_MSG_RESULT(yes)
ifval([$2], [ $2
])dnl
else
AC_MSG_RESULT(no)
ifval([$3], [ $3
])dnl
fi
AC_VAR_POPDEF([ac_var])])
AC_VAR_SET(ac_File, no)
fi])
AC_SHELL_IFELSE([test AC_VAR_GET(ac_File) = yes],
[$2], [$3])dnl
AC_VAR_POPDEF([ac_File])dnl
])# AC_CHECK_FILE
# AC_CHECK_FILES(FILE..., [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])

View File

@ -158,6 +158,17 @@ AH_DEFUN([AH_CHECK_HEADERS],
AH_DEFUN([AC_CHECK_HEADERS], [AH_CHECK_HEADERS($@)])
AH_DEFUN([AC_CHECK_HEADERS_DIRENT], [AH_CHECK_HEADERS($@)])
AH_DEFUN([AC_CHECK_FILES],
[AC_FOREACH([AC_File], [$1],
[AH_TEMPLATE(AC_TR_CPP([HAVE_]AC_File),
[Define if you have the file `]AC_File['.])
# Success
$2
# Failure
$3])])
AH_DEFUN([AC_CHECK_DECLS],
[m4_foreach([AC_Symbol], [$1],
[AH_TEMPLATE(AC_TR_CPP([NEED_]AC_Symbol[_DECL]),

View File

@ -1696,6 +1696,7 @@ define(AC_SUBST_FILE,
s%@$1@%%;t t])])
## --------------------------------------- ##
## Printing messages at autoconf runtime. ##
## --------------------------------------- ##
@ -2633,29 +2634,22 @@ done
#
# Check for the existence of FILE.
AC_DEFUN(AC_CHECK_FILE,
[AC_VAR_PUSHDEF([ac_var], [ac_cv_file_$1])dnl
[AC_VAR_PUSHDEF([ac_File], [ac_cv_file_$1])dnl
dnl FIXME: why was there this line? AC_REQUIRE([AC_PROG_CC])dnl
AC_MSG_CHECKING([for $1])
AC_CACHE_VAL(ac_var,
AC_CACHE_CHECK([for $1], ac_File,
[if test "$cross_compiling" = yes; then
AC_WARNING([Cannot check for file existence when cross compiling])dnl
AC_MSG_ERROR([Cannot check for file existence when cross compiling])
fi
if test -r "[$1]"; then
AC_VAR_SET(ac_var, yes)
AC_VAR_SET(ac_File, yes)
else
AC_VAR_SET(ac_var, no)
fi])dnl
if test AC_VAR_GET(ac_var) = yes; then
AC_MSG_RESULT(yes)
ifval([$2], [ $2
])dnl
else
AC_MSG_RESULT(no)
ifval([$3], [ $3
])dnl
fi
AC_VAR_POPDEF([ac_var])])
AC_VAR_SET(ac_File, no)
fi])
AC_SHELL_IFELSE([test AC_VAR_GET(ac_File) = yes],
[$2], [$3])dnl
AC_VAR_POPDEF([ac_File])dnl
])# AC_CHECK_FILE
# AC_CHECK_FILES(FILE..., [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])

View File

@ -96,3 +96,20 @@ AT_TEST_MACRO(AC_CHECK_TYPES,
/* #undef HAVE_STRUCT_NO */
#define HAVE_STRUCT_YES 1
])])
dnl AC_CHECK_FILES
dnl --------------
dnl FIXME: To really test HAVE_AC_EXISTS2 and HAVE_AC_MISSING2 we need to
dnl open AH_TEMPLATE to `configure.in', which is not yet the case.
AT_TEST_MACRO(AC_CHECK_FILES,
[touch ac-exists1 ac-exists2
ac_exists2=ac-exists2
ac_missing2=ac-missing2
AC_CHECK_FILES(ac-exists1 ac-missing1 $ac_exists2 $ac_missing2)
rm ac-exists1 ac-exists2],
[AT_CHECK_DEFINES(
[#define HAVE_AC_EXISTS1 1
/* #undef HAVE_AC_MISSING1 */
])])