From 7cff7f1ff91b1eaf78aded02424288afef8f11dd Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Wed, 6 May 1998 20:34:37 +0000 Subject: [PATCH] Add support for generic file existence tests (used to simplify some configure.in files.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10551 dc483132-0cff-0310-8789-dd5450dbe970 --- src/ChangeLog | 6 ++++++ src/aclocal.m4 | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 53d7017aa..6ba0b1bed 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +1998-05-06 Theodore Ts'o + + * aclocal.m4 (CONFIG_RELTOPDIR): Add support for generic file + existence tests (used to simplify some configure.in + files.) + Sun Mar 1 22:22:50 1998 Theodore Ts'o * aclocal.m4: Remove unused variables BUILDTOP and SRCTOP (now diff --git a/src/aclocal.m4 b/src/aclocal.m4 index 003028fb3..76097f84c 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -193,6 +193,50 @@ if test $krb5_cv_struct_sigjmp_buf = yes; then fi )])dnl dnl +dnl Generic File existence tests +dnl +dnl K5_AC_CHECK_FILE(FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl +AC_DEFUN(K5_AC_CHECK_FILE, +[AC_REQUIRE([AC_PROG_CC]) +dnl Do the transliteration at runtime so arg 1 can be a shell variable. +ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(ac_cv_file_$ac_safe, +[if test "$cross_compiling" = yes; then + errprint(__file__:__line__: warning: Cannot check for file existence when cross compiling +)dnl + AC_MSG_ERROR(Cannot check for file existence when cross compiling) +else + if test -r $1; then + eval "ac_cv_file_$ac_safe=yes" + else + eval "ac_cv_file_$ac_safe=no" + fi +fi])dnl +if eval "test \"`echo '$ac_cv_file_'$ac_safe`\" = yes"; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) +else + AC_MSG_RESULT(no) +ifelse([$3], , , [$3 +np])dnl +fi +]) +dnl +dnl K5_AC_CHECK_FILES(FILE... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl +AC_DEFUN(K5_AC_CHECK_FILES, +[for ac_file in $1 +do +K5_AC_CHECK_FILE($ac_file, +[changequote(, )dnl + ac_tr_file=HAVE`echo $ac_file | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` +changequote([, ])dnl + AC_DEFINE_UNQUOTED($ac_tr_file) $2], $3)dnl +done +]) +dnl dnl set $(KRB4) from --with-krb4=value -- WITH_KRB4 dnl define(WITH_KRB4,[ -- 2.26.2