From: Ben Elliston Date: Sat, 26 Sep 1998 00:41:55 +0000 (+0000) Subject: 1998-09-26 Ben Elliston X-Git-Tag: autoconf-2-13-rc1~44 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=beefa4266b217506aaa55a0f1e2ac516562b4729;p=thirdparty%2Fautoconf.git 1998-09-26 Ben Elliston * acgeneral.m4 (AC_CHECK_FILE): New macro. Checks for the existence of a file in the file system (native only). Contributed by Theodore Y. Ts'o . (AC_CHECK_FILES): Likewise. --- diff --git a/ChangeLog b/ChangeLog index 4c058cc58..80bb1d27d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +1998-09-26 Ben Elliston + + * acgeneral.m4 (AC_CHECK_FILE): New macro. Checks for the + existence of a file in the file system (native only). + Contributed by Theodore Y. Ts'o . + (AC_CHECK_FILES): Likewise. + 1998-09-15 Ben Elliston * config.guess: Handle strange processor ID assignments on AIX diff --git a/acgeneral.m4 b/acgeneral.m4 index 0f6ed16c5..6af89acfb 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -1766,6 +1766,48 @@ done ]) +dnl ### Checking for the existence of files + +dnl AC_CHECK_FILE(FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(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]) +fi +]) + +dnl AC_CHECK_FILES(FILE... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_CHECK_FILES, +[for ac_file in $1 +do +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 ### Checking for library functions diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 0f6ed16c5..6af89acfb 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -1766,6 +1766,48 @@ done ]) +dnl ### Checking for the existence of files + +dnl AC_CHECK_FILE(FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(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]) +fi +]) + +dnl AC_CHECK_FILES(FILE... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_CHECK_FILES, +[for ac_file in $1 +do +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 ### Checking for library functions