coreutils/m4/decl.m4

44 lines
1.2 KiB
Plaintext
Raw Normal View History

#serial 3
1997-12-14 23:03:38 +08:00
1997-10-23 12:53:06 +08:00
AC_DEFUN(jm_CHECK_DECLARATION,
[
1997-10-24 10:06:52 +08:00
AC_REQUIRE([AC_HEADER_STDC])dnl
1997-10-23 21:28:01 +08:00
test -z "$ac_cv_header_memory_h" && AC_CHECK_HEADERS(memory.h)
test -z "$ac_cv_header_string_h" && AC_CHECK_HEADERS(string.h)
test -z "$ac_cv_header_strings_h" && AC_CHECK_HEADERS(strings.h)
test -z "$ac_cv_header_stdlib_h" && AC_CHECK_HEADERS(stdlib.h)
1997-10-23 21:28:01 +08:00
test -z "$ac_cv_header_unistd_h" && AC_CHECK_HEADERS(unistd.h)
AC_MSG_CHECKING([whether $1 is declared])
AC_CACHE_VAL(jm_cv_func_decl_$1,
[AC_TRY_COMPILE($2,
1997-10-24 10:06:52 +08:00
[
1997-10-23 12:53:06 +08:00
#ifndef $1
char *(*pfn) = (char *(*)) $1
#endif
1997-10-24 10:06:52 +08:00
],
eval "jm_cv_func_decl_$1=yes",
eval "jm_cv_func_decl_$1=no")])
1997-10-23 12:53:06 +08:00
1997-10-24 10:06:52 +08:00
if eval "test \"`echo '$jm_cv_func_decl_'$1`\" = yes"; then
AC_MSG_RESULT(yes)
ifelse([$3], , :, [$3])
1997-10-24 10:06:52 +08:00
else
AC_MSG_RESULT(no)
ifelse([$4], , , [$4
1997-10-23 12:53:06 +08:00
])dnl
1997-10-24 10:06:52 +08:00
fi
1997-10-23 12:53:06 +08:00
])dnl
dnl jm_CHECK_DECLARATIONS(INCLUDES, FUNCTION... [, ACTION-IF-DECLARED
1997-10-23 12:53:06 +08:00
dnl [, ACTION-IF-NOT-DECLARED]])
AC_DEFUN(jm_CHECK_DECLARATIONS,
[
for jm_func in $2
1997-10-23 12:53:06 +08:00
do
jm_CHECK_DECLARATION($jm_func, $1,
1997-10-23 12:53:06 +08:00
[
1997-12-14 15:40:32 +08:00
jm_tr_func=HAVE_DECL_`echo $jm_func | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
AC_DEFINE_UNQUOTED($jm_tr_func) $3], $4)dnl
1997-10-23 12:53:06 +08:00
done
])