* 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
# 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
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
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
])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)
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) ;;
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)
@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
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})
@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
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})
# 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
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
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
])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)
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) ;;
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)