Add support for generic file existence tests (used to simplify some
authorTheodore Tso <tytso@mit.edu>
Wed, 6 May 1998 20:34:37 +0000 (20:34 +0000)
committerTheodore Tso <tytso@mit.edu>
Wed, 6 May 1998 20:34:37 +0000 (20:34 +0000)
configure.in files.)

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10551 dc483132-0cff-0310-8789-dd5450dbe970

src/ChangeLog
src/aclocal.m4

index 53d7017aaddcde32b08d56b340795bb7556a089d..6ba0b1bed7195ab86158c0298e0b3e8ae138080e 100644 (file)
@@ -1,3 +1,9 @@
+1998-05-06  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * 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  <tytso@rsts-11.mit.edu>
 
        * aclocal.m4: Remove unused variables BUILDTOP and SRCTOP (now
index 003028fb3a74c36fc55aa270160a8c2758c12dfe..76097f84c14b701ee278307543feced17f194cf5 100644 (file)
@@ -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,[