]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
fix dir headers, extend have_funcs,headers
authorDavid MacKenzie <djm@djmnet.org>
Sat, 13 Aug 1994 03:28:38 +0000 (03:28 +0000)
committerDavid MacKenzie <djm@djmnet.org>
Sat, 13 Aug 1994 03:28:38 +0000 (03:28 +0000)
NEWS
acgeneral.m4
acspecific.m4
autoconf.texi
doc/autoconf.texi
lib/autoconf/general.m4
lib/autoconf/specific.m4

diff --git a/NEWS b/NEWS
index 73f70f4cb40038ee30605a743815aa1b8b49c2b3..fbe009b5279577bf5c6f5022f82d3e0a3f969d00 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -44,6 +44,8 @@ Major changes in release 2.0:
 * AC_DEFINE no longer prints anything, because of the new result reporting
   mechanism (AC_MSG_CHECKING and AC_MSG_RESULT).
 * AC_VERBOSE pays attention to --quiet/--silent, not --verbose.
+* AC_CHECK_FUNCS and AC_CHECK_HEADERS take an optional arg to execute
+  on a match.
 
 ** New utilities:
 * autoscan to generate a preliminary configure.in for a package by
index 207489e6da1c7ed36693bbc928a6dda2ab8f9859..d0e1a31059e5ab375de6dc4fd065313ab834d303 100644 (file)
@@ -799,6 +799,8 @@ dnl Allow a site initialization script to override cache values.
 # Ultrix sh set writes to stderr and can't be redirected directly.
 (set) 2>&1 | sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1-'\2'}/p" >> $cache_file
 changequote([, ])dnl
+else
+echo "not updating unwritable cache $cache_file"
 fi
 ])dnl
 dnl
@@ -1309,18 +1311,18 @@ ifelse([$3], , , [$3
 fi
 ])dnl
 dnl
-dnl AC_CHECK_FUNCS(FUNCTION...)
+dnl AC_CHECK_FUNCS(FUNCTION... [, ACTION])
 AC_DEFUN(AC_CHECK_FUNCS,
 [for ac_func in $1
 do
 changequote(, )dnl
 ac_tr_func=HAVE_`echo $ac_func | tr '[a-z]' '[A-Z]'`
 changequote([, ])dnl
-AC_CHECK_FUNC(${ac_func}, AC_DEFINE(${ac_tr_func}))dnl
+AC_CHECK_FUNC(${ac_func}, AC_DEFINE(${ac_tr_func}) $2)dnl
 done
 ])dnl
 dnl
-dnl AC_CHECK_HEADERS(HEADER-FILE...)
+dnl AC_CHECK_HEADERS(HEADER-FILE... [, ACTION])
 AC_DEFUN(AC_CHECK_HEADERS,
 [AC_REQUIRE_CPP()dnl Make sure the cpp check happens outside the loop.
 for ac_hdr in $1
@@ -1328,7 +1330,7 @@ do
 changequote(, )dnl
 ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./' '[A-Z]__'`
 changequote([, ])dnl
-AC_CHECK_HEADER(${ac_hdr}, AC_DEFINE(${ac_tr_hdr}))dnl
+AC_CHECK_HEADER(${ac_hdr}, AC_DEFINE(${ac_tr_hdr}) $2)dnl
 done
 ])dnl
 dnl
index 8c70890b1801692e465f8ca0671af87769955af3..447cee9e98e9bfb016f232f410bc91933037d209 100644 (file)
@@ -456,28 +456,14 @@ esac
 ])dnl
 dnl
 AC_DEFUN(AC_HEADER_DIRENT,
-[AC_MSG_CHECKING(for directory library header)
-dnl We don't use AC_CHECK_HEADERS so we can stop when we get a match.
-AC_CACHE_VAL(ac_cv_header_dir,
-[ac_cv_header_dir=no
-for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
-  AC_MSG_CHECKING([for $ac_hdr])
-AC_TRY_LINK([#include <sys/types.h>
-#include <$ac_hdr>], [DIR *dirp = 0;], ac_cv_header_dir=$ac_hdr; break)
-done])dnl
-
-AC_MSG_RESULT($ac_cv_header_dir)
-case "$ac_cv_header_dir" in
-dirent.h) AC_DEFINE(HAVE_DIRENT_H) ;;
-sys/ndir.h) AC_DEFINE(HAVE_SYS_NDIR_H) ;;
-sys/dir.h) AC_DEFINE(HAVE_SYS_DIR_H) ;;
-ndir.h) AC_DEFINE(HAVE_NDIR_H) ;;
-esac
+[ac_header_dir=no
+AC_CHECK_HEADERS(dirent.h sys/ndir.h sys/dir.h ndir.h,
+  [ac_header_dir=$ac_hdr; break])
 
 AC_MSG_CHECKING(whether closedir returns void)
 AC_CACHE_VAL(ac_cv_func_closedir_void,
 [AC_TRY_RUN([#include <sys/types.h>
-#include <$ac_cv_header_dir>
+#include <$ac_header_dir>
 int closedir(); main() { exit(closedir(opendir(".")) != 0); }],
   ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes)])dnl
 AC_MSG_RESULT($ac_cv_func_closedir_void)
@@ -488,17 +474,12 @@ fi
 dnl
 dnl Obsolete.
 AC_DEFUN(AC_DIR_HEADER,
-[AC_MSG_CHECKING(for directory library header)
-AC_CACHE_VAL(ac_cv_header_dir,
-[ac_cv_header_dir=no
+[ac_header_dir=no
 for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
-  AC_MSG_CHECKING([for $ac_hdr])
-AC_TRY_LINK([#include <sys/types.h>
-#include <$ac_hdr>], [DIR *dirp = 0;], ac_cv_header_dir=$ac_hdr; break)
-done])dnl
+  AC_CHECK_HEADER($ac_hdr, [ac_header_dir=$ac_hdr; break])
+done
 
-AC_MSG_RESULT($ac_cv_header_dir)
-case "$ac_cv_header_dir" in
+case "$ac_header_dir" in
 dirent.h) AC_DEFINE(DIRENT) ;;
 sys/ndir.h) AC_DEFINE(SYSNDIR) ;;
 sys/dir.h) AC_DEFINE(SYSDIR) ;;
@@ -508,7 +489,7 @@ esac
 AC_MSG_CHECKING(whether closedir returns void)
 AC_CACHE_VAL(ac_cv_func_closedir_void,
 [AC_TRY_RUN([#include <sys/types.h>
-#include <$ac_cv_header_dir>
+#include <$ac_header_dir>
 int closedir(); main() { exit(closedir(opendir(".")) != 0); }],
   ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes)])dnl
 AC_MSG_RESULT($ac_cv_func_closedir_void)
index d706bde47ba578252c6f99dcee8dfa3c125c8009..f28d30b48c19fbc57e385a0a33e730e605d522c1 100644 (file)
@@ -2092,13 +2092,16 @@ define a symbol if the function is available, consider using
 @code{AC_CHECK_FUNCS} instead.
 @end defmac
 
-@defmac AC_CHECK_FUNCS (@var{function}@dots{})
+@defmac AC_CHECK_FUNCS (@var{function}@dots{} @r{[}, @var{action}@r{]})
 @maindex CHECK_FUNCS
 @vindex HAVE_@var{function}
 For each given @var{function} in the whitespace-separated argument list
 that is available, define @code{HAVE_@var{function}} (in all caps).
 @xref{Specific Tests}, for a precise definition of ``define'' as it
-is used here.  If the functions might be in libraries other than the
+is used here.  If @var{action} is given, it is shell code to execute
+when one of the functions is found.  You can give an @var{action} of
+@samp{break} to break out of the loop on the first match.
+If the functions might be in libraries other than the
 default C library, first call @code{AC_CHECK_LIB} for those libraries.
 @end defmac
 
@@ -2110,13 +2113,16 @@ you just want to define a symbol if the header file is available,
 consider using @code{AC_CHECK_HEADERS} instead.
 @end defmac
 
-@defmac AC_CHECK_HEADERS (@var{header-file}@dots{})
+@defmac AC_CHECK_HEADERS (@var{header-file}@dots{} @r{[}, @var{action}@r{]})
 @maindex CHECK_HEADERS
 @vindex HAVE_@var{header}
 For each given system header file @var{header-file} in the
 whitespace-separated argument list that exists, define
 @code{HAVE_@var{header-file}} (in all caps).  @xref{Specific Tests}, for
 a precise definition of ``define'' as it is used here.
+If @var{action} is given, it is shell code to execute
+when one of the header files is found.  You can give an @var{action} of
+@samp{break} to break out of the loop on the first match.
 @end defmac
 
 @defmac AC_CHECK_SIZEOF (@var{type})
index d706bde47ba578252c6f99dcee8dfa3c125c8009..f28d30b48c19fbc57e385a0a33e730e605d522c1 100644 (file)
@@ -2092,13 +2092,16 @@ define a symbol if the function is available, consider using
 @code{AC_CHECK_FUNCS} instead.
 @end defmac
 
-@defmac AC_CHECK_FUNCS (@var{function}@dots{})
+@defmac AC_CHECK_FUNCS (@var{function}@dots{} @r{[}, @var{action}@r{]})
 @maindex CHECK_FUNCS
 @vindex HAVE_@var{function}
 For each given @var{function} in the whitespace-separated argument list
 that is available, define @code{HAVE_@var{function}} (in all caps).
 @xref{Specific Tests}, for a precise definition of ``define'' as it
-is used here.  If the functions might be in libraries other than the
+is used here.  If @var{action} is given, it is shell code to execute
+when one of the functions is found.  You can give an @var{action} of
+@samp{break} to break out of the loop on the first match.
+If the functions might be in libraries other than the
 default C library, first call @code{AC_CHECK_LIB} for those libraries.
 @end defmac
 
@@ -2110,13 +2113,16 @@ you just want to define a symbol if the header file is available,
 consider using @code{AC_CHECK_HEADERS} instead.
 @end defmac
 
-@defmac AC_CHECK_HEADERS (@var{header-file}@dots{})
+@defmac AC_CHECK_HEADERS (@var{header-file}@dots{} @r{[}, @var{action}@r{]})
 @maindex CHECK_HEADERS
 @vindex HAVE_@var{header}
 For each given system header file @var{header-file} in the
 whitespace-separated argument list that exists, define
 @code{HAVE_@var{header-file}} (in all caps).  @xref{Specific Tests}, for
 a precise definition of ``define'' as it is used here.
+If @var{action} is given, it is shell code to execute
+when one of the header files is found.  You can give an @var{action} of
+@samp{break} to break out of the loop on the first match.
 @end defmac
 
 @defmac AC_CHECK_SIZEOF (@var{type})
index 207489e6da1c7ed36693bbc928a6dda2ab8f9859..d0e1a31059e5ab375de6dc4fd065313ab834d303 100644 (file)
@@ -799,6 +799,8 @@ dnl Allow a site initialization script to override cache values.
 # Ultrix sh set writes to stderr and can't be redirected directly.
 (set) 2>&1 | sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1-'\2'}/p" >> $cache_file
 changequote([, ])dnl
+else
+echo "not updating unwritable cache $cache_file"
 fi
 ])dnl
 dnl
@@ -1309,18 +1311,18 @@ ifelse([$3], , , [$3
 fi
 ])dnl
 dnl
-dnl AC_CHECK_FUNCS(FUNCTION...)
+dnl AC_CHECK_FUNCS(FUNCTION... [, ACTION])
 AC_DEFUN(AC_CHECK_FUNCS,
 [for ac_func in $1
 do
 changequote(, )dnl
 ac_tr_func=HAVE_`echo $ac_func | tr '[a-z]' '[A-Z]'`
 changequote([, ])dnl
-AC_CHECK_FUNC(${ac_func}, AC_DEFINE(${ac_tr_func}))dnl
+AC_CHECK_FUNC(${ac_func}, AC_DEFINE(${ac_tr_func}) $2)dnl
 done
 ])dnl
 dnl
-dnl AC_CHECK_HEADERS(HEADER-FILE...)
+dnl AC_CHECK_HEADERS(HEADER-FILE... [, ACTION])
 AC_DEFUN(AC_CHECK_HEADERS,
 [AC_REQUIRE_CPP()dnl Make sure the cpp check happens outside the loop.
 for ac_hdr in $1
@@ -1328,7 +1330,7 @@ do
 changequote(, )dnl
 ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./' '[A-Z]__'`
 changequote([, ])dnl
-AC_CHECK_HEADER(${ac_hdr}, AC_DEFINE(${ac_tr_hdr}))dnl
+AC_CHECK_HEADER(${ac_hdr}, AC_DEFINE(${ac_tr_hdr}) $2)dnl
 done
 ])dnl
 dnl
index 8c70890b1801692e465f8ca0671af87769955af3..447cee9e98e9bfb016f232f410bc91933037d209 100644 (file)
@@ -456,28 +456,14 @@ esac
 ])dnl
 dnl
 AC_DEFUN(AC_HEADER_DIRENT,
-[AC_MSG_CHECKING(for directory library header)
-dnl We don't use AC_CHECK_HEADERS so we can stop when we get a match.
-AC_CACHE_VAL(ac_cv_header_dir,
-[ac_cv_header_dir=no
-for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
-  AC_MSG_CHECKING([for $ac_hdr])
-AC_TRY_LINK([#include <sys/types.h>
-#include <$ac_hdr>], [DIR *dirp = 0;], ac_cv_header_dir=$ac_hdr; break)
-done])dnl
-
-AC_MSG_RESULT($ac_cv_header_dir)
-case "$ac_cv_header_dir" in
-dirent.h) AC_DEFINE(HAVE_DIRENT_H) ;;
-sys/ndir.h) AC_DEFINE(HAVE_SYS_NDIR_H) ;;
-sys/dir.h) AC_DEFINE(HAVE_SYS_DIR_H) ;;
-ndir.h) AC_DEFINE(HAVE_NDIR_H) ;;
-esac
+[ac_header_dir=no
+AC_CHECK_HEADERS(dirent.h sys/ndir.h sys/dir.h ndir.h,
+  [ac_header_dir=$ac_hdr; break])
 
 AC_MSG_CHECKING(whether closedir returns void)
 AC_CACHE_VAL(ac_cv_func_closedir_void,
 [AC_TRY_RUN([#include <sys/types.h>
-#include <$ac_cv_header_dir>
+#include <$ac_header_dir>
 int closedir(); main() { exit(closedir(opendir(".")) != 0); }],
   ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes)])dnl
 AC_MSG_RESULT($ac_cv_func_closedir_void)
@@ -488,17 +474,12 @@ fi
 dnl
 dnl Obsolete.
 AC_DEFUN(AC_DIR_HEADER,
-[AC_MSG_CHECKING(for directory library header)
-AC_CACHE_VAL(ac_cv_header_dir,
-[ac_cv_header_dir=no
+[ac_header_dir=no
 for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
-  AC_MSG_CHECKING([for $ac_hdr])
-AC_TRY_LINK([#include <sys/types.h>
-#include <$ac_hdr>], [DIR *dirp = 0;], ac_cv_header_dir=$ac_hdr; break)
-done])dnl
+  AC_CHECK_HEADER($ac_hdr, [ac_header_dir=$ac_hdr; break])
+done
 
-AC_MSG_RESULT($ac_cv_header_dir)
-case "$ac_cv_header_dir" in
+case "$ac_header_dir" in
 dirent.h) AC_DEFINE(DIRENT) ;;
 sys/ndir.h) AC_DEFINE(SYSNDIR) ;;
 sys/dir.h) AC_DEFINE(SYSDIR) ;;
@@ -508,7 +489,7 @@ esac
 AC_MSG_CHECKING(whether closedir returns void)
 AC_CACHE_VAL(ac_cv_func_closedir_void,
 [AC_TRY_RUN([#include <sys/types.h>
-#include <$ac_cv_header_dir>
+#include <$ac_header_dir>
 int closedir(); main() { exit(closedir(opendir(".")) != 0); }],
   ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes)])dnl
 AC_MSG_RESULT($ac_cv_func_closedir_void)